2026-06-03 00:17:12 +12:00
|
|
|
import { redirect } from '@sveltejs/kit';
|
|
|
|
|
import { api } from '$lib/api';
|
|
|
|
|
import { getStoredClientSession, hasStoredClientSession } from '$lib/session';
|
|
|
|
|
import { canOpenEditor, getWorkspaceHomeHref } from '$lib/workspace-access';
|
|
|
|
|
|
|
|
|
|
export async function load({ fetch }) {
|
|
|
|
|
if (!hasStoredClientSession()) {
|
|
|
|
|
return { rows: [] };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const session = getStoredClientSession();
|
|
|
|
|
if (!canOpenEditor(session)) {
|
|
|
|
|
throw redirect(307, getWorkspaceHomeHref(session));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const [rows, rawMaterials] = await Promise.all([
|
2026-06-13 10:00:15 +12:00
|
|
|
api.editorMixes({ limit: 1000 }, fetch),
|
2026-06-03 00:17:12 +12:00
|
|
|
api.rawMaterials(fetch)
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
rows,
|
|
|
|
|
rawMaterials
|
|
|
|
|
};
|
|
|
|
|
} catch {
|
|
|
|
|
return { rows: [], rawMaterials: [] };
|
|
|
|
|
}
|
|
|
|
|
}
|