From f47f72ba17a3a838ce6e192ea7db9f9b16f9ef1c Mon Sep 17 00:00:00 2001 From: Yohan Boujon Date: Sun, 12 Nov 2023 15:03:38 +0100 Subject: [PATCH] Frontend: Boilerplate to integrate database. --- frontend/src/routes/+page.js | 14 ++++++++++++++ frontend/src/routes/+page.svelte | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 frontend/src/routes/+page.js diff --git a/frontend/src/routes/+page.js b/frontend/src/routes/+page.js new file mode 100644 index 0000000..3ea80af --- /dev/null +++ b/frontend/src/routes/+page.js @@ -0,0 +1,14 @@ +export async function load(context) { + const res = await context.fetch("http://0.0.0.0:8000/info"); + const info = await res.json(); + + if (!res.ok) { + return { + status: 500, + error: new Error("Internal Server Error"), + }; + } + return { + info, + }; +} diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 999d67c..3de68dd 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -1,7 +1,8 @@
-

Le super CV de {prenom}

+

Le super CV de {info.full_name}

\ No newline at end of file