feat: borrar usaurios

This commit is contained in:
2025-12-29 21:58:56 -03:00
parent 98b1b0d9f2
commit b7cfa77a91
7 changed files with 110 additions and 15 deletions

View File

@@ -0,0 +1,21 @@
import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function borrarUsuario(id: string) {
try {
const req = await fetch(`${get(apiBase)}/api/users/${id}`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (req.ok) {
return true;
}
return false;
} catch {
return false;
}
}