Feat ERP 3
This commit is contained in:
33
frontend/counter-panel/src/services/clientService.ts
Normal file
33
frontend/counter-panel/src/services/clientService.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
// src/services/clientService.ts
|
||||
import api from './api';
|
||||
|
||||
export interface CreateClientRequest {
|
||||
name: string;
|
||||
dniOrCuit: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
address?: string;
|
||||
taxType: string;
|
||||
}
|
||||
|
||||
export const clientService = {
|
||||
getAll: async (q?: string) => {
|
||||
const res = await api.get('/clients', { params: { q } });
|
||||
return res.data;
|
||||
},
|
||||
getSummary: async (id: number) => {
|
||||
const res = await api.get(`/clients/${id}/summary`);
|
||||
return res.data;
|
||||
},
|
||||
update: async (id: number, clientData: any) => {
|
||||
await api.put(`/clients/${id}`, clientData);
|
||||
},
|
||||
resetPassword: async (id: number) => {
|
||||
const res = await api.post(`/clients/${id}/reset-password`);
|
||||
return res.data;
|
||||
},
|
||||
create: async (data: CreateClientRequest) => {
|
||||
const res = await api.post('/clients', data);
|
||||
return res.data; // Retorna { id, name, dniOrCuit }
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user