creates application
This commit is contained in:
23
frontend/src/api/clients.ts
Normal file
23
frontend/src/api/clients.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import apiClient from './client';
|
||||
import type { Client, CreateClientInput, UpdateClientInput } from '@/types';
|
||||
|
||||
export const clientsApi = {
|
||||
getAll: async (): Promise<Client[]> => {
|
||||
const { data } = await apiClient.get<Client[]>('/clients');
|
||||
return data;
|
||||
},
|
||||
|
||||
create: async (input: CreateClientInput): Promise<Client> => {
|
||||
const { data } = await apiClient.post<Client>('/clients', input);
|
||||
return data;
|
||||
},
|
||||
|
||||
update: async (id: string, input: UpdateClientInput): Promise<Client> => {
|
||||
const { data } = await apiClient.put<Client>(`/clients/${id}`, input);
|
||||
return data;
|
||||
},
|
||||
|
||||
delete: async (id: string): Promise<void> => {
|
||||
await apiClient.delete(`/clients/${id}`);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user