Updates
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { api } from '$lib/api';
|
||||
import { hasStoredAdminSession, hasStoredClientSession } from '$lib/session';
|
||||
import { getStoredClientSession, hasStoredAdminSession, hasStoredClientSession } from '$lib/session';
|
||||
import { canOpenClientAccess, getWorkspaceHomeHref } from '$lib/workspace-access';
|
||||
|
||||
function emptyPayload() {
|
||||
return {
|
||||
@@ -21,6 +23,13 @@ export async function load({ fetch }) {
|
||||
return emptyPayload();
|
||||
}
|
||||
|
||||
if (hasStoredClientSession()) {
|
||||
const session = getStoredClientSession();
|
||||
if (session && !canOpenClientAccess(session)) {
|
||||
throw redirect(307, getWorkspaceHomeHref(session));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const [clients, exportPreview] = await Promise.all([api.clientAccess(fetch), api.clientAccessExport(fetch)]);
|
||||
return { clients, exportPreview };
|
||||
|
||||
Reference in New Issue
Block a user