mirror of
http://88.130.71.182:3000/BlitTech/badoHair_fe.git
synced 2026-06-13 08:58:31 +00:00
23 lines
730 B
TypeScript
23 lines
730 B
TypeScript
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 });
|
|
}
|