Subir todos los cambios recientes a la rama principal

This commit is contained in:
arielit3
2026-01-16 13:39:55 -07:00
parent de5b6feef4
commit 99427cd48c
38 changed files with 15383 additions and 66 deletions

View File

@@ -0,0 +1,45 @@
import { writable } from 'svelte/store';
export const api = {
async getClients() {
const response = await fetch('/api/v1/clients');
if (!response.ok) {
throw new Error('Error fetching clients');
}
return await response.json();
},
async createClient(client) {
const response = await fetch('/api/v1/clients', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(client),
});
if (!response.ok) {
throw new Error('Error creating client');
}
return await response.json();
},
async updateClient(clientId, client) {
const response = await fetch(`/api/v1/clients/${clientId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(client),
});
if (!response.ok) {
throw new Error('Error updating client');
}
return await response.json();
},
async deleteClient(clientId) {
const response = await fetch(`/api/v1/clients/${clientId}`, {
method: 'DELETE',
});
if (!response.ok) {
throw new Error('Error deleting client');
}
return await response.json();
},
};