diff --git a/client/src/routes/+page.server.js b/client/src/routes/+layout.server.js
similarity index 100%
rename from client/src/routes/+page.server.js
rename to client/src/routes/+layout.server.js
diff --git a/client/src/routes/+layout.svelte b/client/src/routes/+layout.svelte
index bfad820..4bd5bb6 100644
--- a/client/src/routes/+layout.svelte
+++ b/client/src/routes/+layout.svelte
@@ -1,5 +1,13 @@
+
+
Welcome to Local Bargains
- Sign up
- Sign in
+{#if data.accessToken}
+ {data.accessToken}
+{:else}
+ Sign up
+ Sign in
+{/if}
diff --git a/client/src/routes/+page.svelte b/client/src/routes/+page.svelte
index 91ed746..18b7c9f 100644
--- a/client/src/routes/+page.svelte
+++ b/client/src/routes/+page.svelte
@@ -1,6 +1,3 @@
-
-
Local Bargains!
diff --git a/client/src/routes/auth/login/+page.server.js b/client/src/routes/auth/login/+page.server.js
index a33ff3b..b239db4 100644
--- a/client/src/routes/auth/login/+page.server.js
+++ b/client/src/routes/auth/login/+page.server.js
@@ -1,4 +1,5 @@
import { fail, redirect } from '@sveltejs/kit';
+import * as set_cookie_parser from 'set-cookie-parser';
export const actions = {
form: async ({ request, url, cookies }) => {
@@ -34,8 +35,11 @@ export const actions = {
message: 'Bad password!'
});
}
- console.log(response);
- console.log(cookies.getAll());
+ const { headers } = response;
+ for (const str of set_cookie_parser.splitCookiesString(headers.get('set-cookie'))) {
+ const { name, value, ...options } = set_cookie_parser.parseString(str);
+ cookies.set(name, value, { ...options });
+ }
throw redirect(303, url.searchParams.get('redirectTo') || '/');
}
}