qa: Fix load functions not awaited since SvelteKit 2
This commit is contained in:
parent
81cd6fe3a1
commit
fb6a5d8063
|
@ -3,11 +3,12 @@ import { getExerciceQA } from '$lib/qa.js';
|
|||
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
export async function load({ depends, params }) {
|
||||
const exercice = getExercice(params.eid)
|
||||
depends(`api/exercices/${params.eid}`);
|
||||
|
||||
const qaitems = getExerciceQA(params.eid);
|
||||
const [exercice, qaitems] = await Promise.all([
|
||||
getExercice(params.eid),
|
||||
getExerciceQA(params.eid),
|
||||
]);
|
||||
depends(`api/exercices/${params.eid}/qa`);
|
||||
depends(`api/exercices/${params.eid}`);
|
||||
|
||||
return { exercice, qaitems };
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { getTheme } from '$lib/themes';
|
|||
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
export async function load({ depends, params }) {
|
||||
const theme = getTheme(params.tid)
|
||||
const theme = await getTheme(params.tid)
|
||||
depends(`api/themes/${params.tid}`);
|
||||
|
||||
return { theme };
|
||||
|
|
|
@ -5,10 +5,11 @@ import { getExerciceQA } from '$lib/qa.js';
|
|||
export async function load({ depends, params, parent }) {
|
||||
const { theme } = await parent();
|
||||
|
||||
const exercice = getExercice(params.eid)
|
||||
const [exercice, qaitems] = await Promise.all([
|
||||
getExercice(params.eid),
|
||||
getExerciceQA(params.eid),
|
||||
]);
|
||||
depends(`api/exercices/${params.eid}`);
|
||||
|
||||
const qaitems = getExerciceQA(params.eid);
|
||||
depends(`api/exercices/${params.eid}/qa`);
|
||||
|
||||
return { exercice, qaitems, theme };
|
||||
|
|
Loading…
Reference in New Issue