diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/+layout.svelte | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 8ec6cb28..2fdfbc4d 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,12 +4,19 @@ import { onMount } from 'svelte'; import userIdentity from '../stores/userIdentity'; import settings from '../stores/settings'; + import { browser } from '$app/environment'; export let data; let currentUserIdentity = { name: '...', id: -1 }; onMount(async () => { + if (browser && localStorage.getItem('redirect')) { + window.location.href = localStorage.getItem('redirect') ?? '/'; + + localStorage.removeItem('redirect'); + } + settings.get(); if (data.user !== undefined) { @@ -39,6 +46,12 @@ {#if data.user === undefined} <a href={`https://anilist.co/api/v2/oauth/authorize?client_id=${env.PUBLIC_ANILIST_CLIENT_ID}&redirect_uri=${env.PUBLIC_ANILIST_REDIRECT_URI}&response_type=code`} + on:click={() => { + localStorage.setItem( + 'redirect', + window.location.origin + window.location.pathname + window.location.search + ); + }} > Log in with AniList </a> |