Files
Repuestera/front/src/lib/hooks/borrarUsuario.ts
T
2026-05-11 17:19:19 -03:00

11 lines
339 B
TypeScript

import { API_URL } from '../env';
import { getToken } from './token';
export async function borrarUsuario(id: number): Promise<void> {
const response = await fetch(`${API_URL}/users/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${getToken()}` }
});
if (!response.ok) throw new Error('Error al eliminar usuario');
}