21 lines
336 B
TypeScript
21 lines
336 B
TypeScript
|
|
import { hasStoredClientSession } from '$lib/session';
|
||
|
|
import { api } from '$lib/api';
|
||
|
|
|
||
|
|
export async function load() {
|
||
|
|
if (!hasStoredClientSession()) {
|
||
|
|
return {
|
||
|
|
rawMaterials: []
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
try {
|
||
|
|
return {
|
||
|
|
rawMaterials: await api.rawMaterials()
|
||
|
|
};
|
||
|
|
} catch {
|
||
|
|
return {
|
||
|
|
rawMaterials: []
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|