Add customer/manager access UI and tighten customers filters.
Business and super-admin can set Customer vs Manager roles (Admin only for super-admin), and the customers page drops clutter while filtering by all/customers/managers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
404c008ced
commit
f622e6d605
@@ -33,3 +33,40 @@ export async function updateTeamMemberRole(
|
||||
body: { roleSlug },
|
||||
})
|
||||
}
|
||||
|
||||
export type BusinessAccess = 'customer' | 'staff'
|
||||
|
||||
export interface AssignBusinessAccessPayload {
|
||||
userId: number | string
|
||||
access: BusinessAccess
|
||||
roleSlug?: string
|
||||
}
|
||||
|
||||
export interface AssignBusinessAccessResult {
|
||||
message: string
|
||||
access: BusinessAccess
|
||||
member: {
|
||||
id: number
|
||||
userId: number
|
||||
isOwner: boolean
|
||||
teamRole: string | null
|
||||
} | null
|
||||
}
|
||||
|
||||
/** Set customer vs staff (admin/editor/viewer) for a user on one business. */
|
||||
export async function assignBusinessAccess(
|
||||
businessId: number | string,
|
||||
payload: AssignBusinessAccessPayload,
|
||||
) {
|
||||
return apiRequest<AssignBusinessAccessResult>(`/businesses/${businessId}/team/access`, {
|
||||
method: 'PATCH',
|
||||
auth: true,
|
||||
body: {
|
||||
userId: String(payload.userId),
|
||||
access: payload.access,
|
||||
...(payload.access === 'staff' && payload.roleSlug
|
||||
? { roleSlug: payload.roleSlug }
|
||||
: {}),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user