diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..ec43c6a --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,19 @@ + + + + + + Oops, looks like this page doesn´t exist + + + + + + It's ok it sometimes happens to everyone + + Go back to the landing page + + + + + \ No newline at end of file diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index a3d1578..790a18b 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1 +1,16 @@ export const ssr = false; + +import { redirect } from '@sveltejs/kit'; +import getLocalDB from '$lib/utils/localDB/manager'; + +const loginLock = ['/interface']; +//redirect to login in locked pages +export const load = async ({ url }) => { + const db = getLocalDB(); + if (loginLock.includes(url?.pathname) && !db.userID) { + throw redirect(302, '/auth/login'); + } + return { + user: db?.userID || null + }; +}; \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index fa6b0cf..2325834 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,4 +1,6 @@ @@ -30,11 +32,24 @@ Build intuitive Discord Bots using visual scripting extremely similar to Scratch. + {#if user} + Home + Workspace + {:else} Getting Started + {/if} diff --git a/static/images/itsfine.gif b/static/images/itsfine.gif new file mode 100644 index 0000000..7de7135 Binary files /dev/null and b/static/images/itsfine.gif differ
It's ok it sometimes happens to everyone
Build intuitive Discord Bots using visual scripting extremely similar to Scratch.