Added user-screen

This commit is contained in:
Mawoka
2023-01-25 18:58:50 +01:00
parent 95b0a4fa63
commit 8d544d7c88
8 changed files with 843 additions and 606 deletions
@@ -0,0 +1,24 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import type { PageLoad } from './$types';
export const load = (async ({ params, fetch }) => {
const user_req = await fetch(`/api/v1/community/user/${params.user_id}`);
const user = await user_req.json();
if (!user) {
return {
user: undefined,
quizzes: undefined
};
}
const quiz_req = await fetch(`/api/v1/community/quizzes/${params.user_id}?imported=false`);
const quizzes = await quiz_req.json();
return {
user,
quizzes
};
}) satisfies PageLoad;