mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-13 11:03:02 +00:00
Update May 12 by Elvis
This commit is contained in:
22
lib/api/customers.ts
Normal file
22
lib/api/customers.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { api, PaginatedResult } from "@/lib/api";
|
||||
|
||||
export interface CustomerApi {
|
||||
id: string;
|
||||
email: string;
|
||||
full_name: string | null;
|
||||
phone: string | null;
|
||||
is_blocked: boolean;
|
||||
created_at: string;
|
||||
orders_count: number;
|
||||
bookings_count: number;
|
||||
total_spent: number;
|
||||
}
|
||||
|
||||
export async function adminListCustomers(search?: string): Promise<PaginatedResult<CustomerApi>> {
|
||||
const qs = search ? `?search=${encodeURIComponent(search)}&per_page=100` : "?per_page=100";
|
||||
return api.get<PaginatedResult<CustomerApi>>(`/admin/customers${qs}`);
|
||||
}
|
||||
|
||||
export async function adminBlockCustomer(id: string, is_blocked: boolean): Promise<CustomerApi> {
|
||||
return api.patch<CustomerApi>(`/admin/customers/${id}`, { is_blocked });
|
||||
}
|
||||
Reference in New Issue
Block a user