Files
data-entry-app/frontend/src/routes/admin/client-access/+page.ts
T

42 lines
848 B
TypeScript
Raw Normal View History

2026-04-25 22:51:36 +12:00
import { hasStoredAdminSession } from '$lib/session';
import { api } from '$lib/api';
2026-04-27 21:53:36 +12:00
export async function load({ fetch }) {
2026-04-25 22:51:36 +12:00
if (!hasStoredAdminSession()) {
return {
clients: [],
exportPreview: {
generated_at: '',
client_rows: [],
user_rows: [],
feature_rows: [],
permission_rows: [],
audit_rows: [],
2026-04-25 22:51:36 +12:00
clients: []
}
};
}
try {
2026-04-27 21:53:36 +12:00
const [clients, exportPreview] = await Promise.all([api.clientAccess(fetch), api.clientAccessExport(fetch)]);
2026-04-25 22:51:36 +12:00
return {
clients,
exportPreview
};
} catch {
return {
clients: [],
exportPreview: {
generated_at: '',
client_rows: [],
user_rows: [],
feature_rows: [],
permission_rows: [],
audit_rows: [],
2026-04-25 22:51:36 +12:00
clients: []
}
};
}
}