From 70cb3be644652ea72f99725d10e9690e01d06817 Mon Sep 17 00:00:00 2001 From: Marc Hyeler Date: Fri, 13 Oct 2023 17:31:22 +0000 Subject: [PATCH] test cookie --- src/routes/admin/+page.server.js | 48 +++++++++++++++++++------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/routes/admin/+page.server.js b/src/routes/admin/+page.server.js index ebf998b..81b1198 100644 --- a/src/routes/admin/+page.server.js +++ b/src/routes/admin/+page.server.js @@ -1,26 +1,34 @@ import { redirect } from '@sveltejs/kit'; -export async function load({ request }) { - const authToken = request.headers.get('Authorization'); +// export async function load({ request }) { +// const authToken = request.headers.get('Authorization'); - console.log(request) - try { - console.log("hello") - const response = await fetch('http://mysql-container/auth/checkAuth', { - headers: { - 'Authorization': authToken - } - }); - console.log(response.ok) - if (!response.ok) { - throw redirect(302, '/login'); - } +// console.log(request) +// try { +// console.log("hello") +// const response = await fetch('http://locker-backend:3000/auth/checkAuth', { +// headers: { +// 'Authorization': authToken +// } +// }); +// console.log(response.ok) +// if (!response.ok) { +// throw redirect(302, '/login'); +// } - // Continue loading the route as usual - return { props: {} }; +// // Continue loading the route as usual +// return { props: {} }; - } catch (error) { - console.error("Error checking authentication:", error); - throw redirect(302, '/login'); - } +// } catch (error) { +// console.error("Error checking authentication:", error); +// throw redirect(302, '/login'); +// } +// } + +export function load({ cookies }) { + const visited = cookies.get('connect.sid'); + + // cookies.set('visited', 'true', { path: '/' }); + + console.log(visited) } \ No newline at end of file