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: [],
|
|
|
|
|
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: [],
|
|
|
|
|
clients: []
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|