Move working documents to its own area, rename dashboard
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { api } from '$lib/api';
|
||||
import { hasStoredClientSession } from '$lib/session';
|
||||
import { getStoredClientSession, hasModuleAccess, hasStoredClientSession } from '$lib/session';
|
||||
|
||||
export async function load({ params, fetch }) {
|
||||
const mixId = Number(params.id);
|
||||
@@ -16,8 +16,19 @@ export async function load({ params, fetch }) {
|
||||
};
|
||||
}
|
||||
|
||||
const session = getStoredClientSession();
|
||||
if (!hasModuleAccess(session, 'mix_master')) {
|
||||
return {
|
||||
mix: null,
|
||||
rawMaterials: []
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const [mix, rawMaterials] = await Promise.all([api.mix(mixId, fetch), api.rawMaterials(fetch)]);
|
||||
const [mix, rawMaterials] = await Promise.all([
|
||||
api.mix(mixId, fetch),
|
||||
hasModuleAccess(session, 'raw_materials') ? api.rawMaterials(fetch) : Promise.resolve([])
|
||||
]);
|
||||
|
||||
return {
|
||||
mix,
|
||||
|
||||
Reference in New Issue
Block a user