38 lines
723 B
TypeScript
38 lines
723 B
TypeScript
|
|
import { hasStoredAdminSession } from '$lib/session';
|
||
|
|
import { api } from '$lib/api';
|
||
|
|
|
||
|
|
export async function load() {
|
||
|
|
if (!hasStoredAdminSession()) {
|
||
|
|
return {
|
||
|
|
clients: [],
|
||
|
|
exportPreview: {
|
||
|
|
generated_at: '',
|
||
|
|
client_rows: [],
|
||
|
|
user_rows: [],
|
||
|
|
feature_rows: [],
|
||
|
|
clients: []
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
try {
|
||
|
|
const [clients, exportPreview] = await Promise.all([api.clientAccess(), api.clientAccessExport()]);
|
||
|
|
|
||
|
|
return {
|
||
|
|
clients,
|
||
|
|
exportPreview
|
||
|
|
};
|
||
|
|
} catch {
|
||
|
|
return {
|
||
|
|
clients: [],
|
||
|
|
exportPreview: {
|
||
|
|
generated_at: '',
|
||
|
|
client_rows: [],
|
||
|
|
user_rows: [],
|
||
|
|
feature_rows: [],
|
||
|
|
clients: []
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|