mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-09-30 10:03:14 +00:00
22 lines
561 B
TypeScript
22 lines
561 B
TypeScript
|
|
import apiClient from './client';
|
||
|
|
|
||
|
|
export interface Customer {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
addresses: string[];
|
||
|
|
createdAt: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const customersApi = {
|
||
|
|
search: async (query?: string): Promise<Customer[]> => {
|
||
|
|
const params = query ? `?query=${encodeURIComponent(query)}` : '';
|
||
|
|
const res = await apiClient.get(`/customers${params}`);
|
||
|
|
return res.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
create: async (data: { name: string; addresses?: string[] }): Promise<Customer> => {
|
||
|
|
const res = await apiClient.post('/customers', data);
|
||
|
|
return res.data;
|
||
|
|
},
|
||
|
|
};
|