add more data
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import type { OffsetPaginated, PermissionGroup, RoleDetail, UserSummary } from '@sport/types';
|
||||
import type {
|
||||
AdminCustomer,
|
||||
AdminCustomerDetail,
|
||||
OffsetPaginated,
|
||||
PermissionGroup,
|
||||
RoleDetail,
|
||||
UserSummary,
|
||||
} from '@sport/types';
|
||||
|
||||
import type { HttpClient } from '../http-client';
|
||||
|
||||
@@ -44,6 +51,13 @@ export interface AdminResource {
|
||||
updateUser(id: string, payload: UpdateUserPayload): Promise<UserSummary>;
|
||||
resetUserPassword(id: string, password: string): Promise<{ ok: true }>;
|
||||
|
||||
listCustomers(params?: {
|
||||
page?: number;
|
||||
perPage?: number;
|
||||
q?: string;
|
||||
}): Promise<OffsetPaginated<AdminCustomer>>;
|
||||
getCustomer(id: string): Promise<AdminCustomerDetail>;
|
||||
|
||||
listRoles(): Promise<RoleDetail[]>;
|
||||
getRole(id: string): Promise<RoleDetail>;
|
||||
listPermissions(): Promise<PermissionGroup[]>;
|
||||
@@ -73,6 +87,14 @@ export function createAdminResource(http: HttpClient): AdminResource {
|
||||
uncached,
|
||||
),
|
||||
|
||||
listCustomers: (params = {}) =>
|
||||
http.get<OffsetPaginated<AdminCustomer>>('/admin/customers', {
|
||||
...uncached,
|
||||
query: { ...params },
|
||||
}),
|
||||
getCustomer: (id) =>
|
||||
http.get<AdminCustomerDetail>(`/admin/customers/${encodeURIComponent(id)}`, uncached),
|
||||
|
||||
listRoles: () => http.get<RoleDetail[]>('/admin/roles', uncached),
|
||||
getRole: (id) => http.get<RoleDetail>(`/admin/roles/${encodeURIComponent(id)}`, uncached),
|
||||
listPermissions: () => http.get<PermissionGroup[]>('/admin/roles/permissions', uncached),
|
||||
|
||||
Reference in New Issue
Block a user