qa: Fix load functions not awaited since SvelteKit 2
This commit is contained in:
parent
81cd6fe3a1
commit
fb6a5d8063
3 changed files with 10 additions and 8 deletions
|
@ -3,11 +3,12 @@ import { getExerciceQA } from '$lib/qa.js';
|
||||||
|
|
||||||
/** @type {import('./$types').PageLoad} */
|
/** @type {import('./$types').PageLoad} */
|
||||||
export async function load({ depends, params }) {
|
export async function load({ depends, params }) {
|
||||||
const exercice = getExercice(params.eid)
|
const [exercice, qaitems] = await Promise.all([
|
||||||
depends(`api/exercices/${params.eid}`);
|
getExercice(params.eid),
|
||||||
|
getExerciceQA(params.eid),
|
||||||
const qaitems = getExerciceQA(params.eid);
|
]);
|
||||||
depends(`api/exercices/${params.eid}/qa`);
|
depends(`api/exercices/${params.eid}/qa`);
|
||||||
|
depends(`api/exercices/${params.eid}`);
|
||||||
|
|
||||||
return { exercice, qaitems };
|
return { exercice, qaitems };
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { getTheme } from '$lib/themes';
|
||||||
|
|
||||||
/** @type {import('./$types').PageLoad} */
|
/** @type {import('./$types').PageLoad} */
|
||||||
export async function load({ depends, params }) {
|
export async function load({ depends, params }) {
|
||||||
const theme = getTheme(params.tid)
|
const theme = await getTheme(params.tid)
|
||||||
depends(`api/themes/${params.tid}`);
|
depends(`api/themes/${params.tid}`);
|
||||||
|
|
||||||
return { theme };
|
return { theme };
|
||||||
|
|
|
@ -5,10 +5,11 @@ import { getExerciceQA } from '$lib/qa.js';
|
||||||
export async function load({ depends, params, parent }) {
|
export async function load({ depends, params, parent }) {
|
||||||
const { theme } = await 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}`);
|
depends(`api/exercices/${params.eid}`);
|
||||||
|
|
||||||
const qaitems = getExerciceQA(params.eid);
|
|
||||||
depends(`api/exercices/${params.eid}/qa`);
|
depends(`api/exercices/${params.eid}/qa`);
|
||||||
|
|
||||||
return { exercice, qaitems, theme };
|
return { exercice, qaitems, theme };
|
||||||
|
|
Reference in a new issue