Private
Public Access
funcionalidad de logs andando
This commit is contained in:
1 parent
06ed4a518b
commit
aac88856ac
21 files changed
+627
-31
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { API_URL } from '$lib/env';
|
||||
import type { RespuestaPagina } from '../../../routes/logs/LogsEstado.svelte';
|
||||
import type { LogEntry } from '../../../types';
|
||||
import { getToken } from '../token';
|
||||
|
||||
export async function obtenerLogs(pagina: number): Promise<RespuestaPagina<LogEntry>> {
|
||||
const res = await fetch(`${API_URL}/logs/${pagina}/`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${getToken()}`
|
||||
}
|
||||
});
|
||||
if (!res.ok) throw new Error(`No se pudieron cargar los logs (${res.status})`);
|
||||
const data = await res.json();
|
||||
return { logs: data.logs, maxPagina: data.maxLenght };
|
||||
}
|
||||
Reference in new issue
Block a user