añadido soporte para mandar una query al back

This commit is contained in:
2026-01-26 16:33:26 -03:00
parent 9c59c3d036
commit ceec19fb91
3 changed files with 68 additions and 36 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 busquedaAdminUsuarios(q: string) {
try {
const response = await fetch(get(apiBase) + '/api/admin/users?q=' + q, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}
});
if (response.ok) {
return await response.json();
}
return [];
} catch {
return [];
}
}