fix(web): gate staff-only Convex queries to avoid RBAC errors on dashboard and tickets; docs: add desktop agent history and troubleshooting
This commit is contained in:
parent
7685370c05
commit
ab820ddeca
11 changed files with 144 additions and 33 deletions
|
|
@ -14,11 +14,12 @@ interface TicketQueueSummaryProps {
|
|||
}
|
||||
|
||||
export function TicketQueueSummaryCards({ queues }: TicketQueueSummaryProps) {
|
||||
const { convexUserId } = useAuth()
|
||||
const queueArgs = convexUserId
|
||||
const { convexUserId, isStaff } = useAuth()
|
||||
const enabled = Boolean(isStaff && convexUserId)
|
||||
const queueArgs = enabled
|
||||
? { tenantId: DEFAULT_TENANT_ID, viewerId: convexUserId as Id<"users"> }
|
||||
: "skip"
|
||||
const fromServer = useQuery(convexUserId ? api.queues.summary : "skip", queueArgs)
|
||||
const fromServer = useQuery(enabled ? api.queues.summary : "skip", queueArgs)
|
||||
const data: TicketQueueSummary[] = (queues ?? (fromServer as TicketQueueSummary[] | undefined) ?? [])
|
||||
|
||||
if (!queues && fromServer === undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue