From 977f481814185ee7b728622aec27852bb9cac436 Mon Sep 17 00:00:00 2001
From: Geoff Rich <4992896+geoffrich@users.noreply.github.com>
Date: Sat, 29 Jul 2023 12:59:44 -0700
Subject: [PATCH 1/2] Update demo with login/logout
---
demo/src/routes/+layout.server.js | 5 +++++
demo/src/routes/+layout.svelte | 7 ++++++-
demo/src/routes/Header.svelte | 11 +++++++++++
demo/src/routes/about/+page.js | 4 ----
4 files changed, 22 insertions(+), 5 deletions(-)
create mode 100644 demo/src/routes/+layout.server.js
diff --git a/demo/src/routes/+layout.server.js b/demo/src/routes/+layout.server.js
new file mode 100644
index 0000000..2ec7ce4
--- /dev/null
+++ b/demo/src/routes/+layout.server.js
@@ -0,0 +1,5 @@
+export const load = ({ platform }) => {
+ return {
+ clientPrincipal: platform?.clientPrincipal
+ };
+};
diff --git a/demo/src/routes/+layout.svelte b/demo/src/routes/+layout.svelte
index 9c7445f..df3525e 100644
--- a/demo/src/routes/+layout.svelte
+++ b/demo/src/routes/+layout.svelte
@@ -1,12 +1,17 @@
-
+
+ {#if data.clientPrincipal}
+ {JSON.stringify(data.clientPrincipal)}
+ {/if}
diff --git a/demo/src/routes/Header.svelte b/demo/src/routes/Header.svelte
index 368b721..d05cc03 100644
--- a/demo/src/routes/Header.svelte
+++ b/demo/src/routes/Header.svelte
@@ -2,6 +2,8 @@
import { page } from '$app/stores';
import logo from '$lib/images/svelte-logo.svg';
import github from '$lib/images/github.svg';
+
+ export let isLoggedIn = false;
@@ -25,6 +27,15 @@
Sverdle
+ {#if isLoggedIn}
+
+ Logout
+
+ {:else}
+
+ Login
+
+ {/if}