aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/+layout.svelte25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index a9c294c2..a1e9ef4b 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -45,6 +45,13 @@
? 200
: -200;
+ $: {
+ if (data.user !== undefined)
+ getUserIdentity(data.user).then((h) => {
+ if ($userIdentity.id === -2) userIdentity.set(h);
+ });
+ }
+
onMount(async () => {
if (browser && localStorage.getItem('redirect')) {
window.location.href = localStorage.getItem('redirect') ?? '/';
@@ -53,10 +60,6 @@
}
settings.get();
-
- if (data.user !== undefined) {
- if ($userIdentity.id === -1) userIdentity.set(await getUserIdentity(data.user));
- }
});
</script>
@@ -98,7 +101,19 @@
{$locale().navigation.logIn}
</a>
{:else}
- <a href={root('/api/authentication/log-out')} class="header-item">
+ <a
+ href={'#'}
+ class="header-item"
+ on:click={() => {
+ userIdentity.set({
+ id: -2,
+ name: '',
+ avatar: 'https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png'
+ });
+
+ window.location.href = root('/api/authentication/log-out');
+ }}
+ >
{$locale().navigation.logOut}
</a>
{#if data.user}