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/+page.js b/demo/src/routes/+page.js deleted file mode 100644 index a72419a..0000000 --- a/demo/src/routes/+page.js +++ /dev/null @@ -1,3 +0,0 @@ -// since there's no dynamic data here, we can prerender -// it so that it gets served as a static asset in production -export const prerender = true; 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}