diff options
| author | Kit La Touche <kit@transneptune.net> | 2025-02-21 23:19:30 -0500 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2025-02-21 23:19:30 -0500 |
| commit | e561ff74b81209b8e0f0c7cc63861a2ef70d19bf (patch) | |
| tree | 54ca1c1d718f54c9d9725dd050ae540b181870e2 /ui/routes/+layout.svelte | |
| parent | 9d1dbac74866a6175c65a25bbd8a3ccbe8cf87e4 (diff) | |
Only redirect to last active channel off of /
Diffstat (limited to 'ui/routes/+layout.svelte')
| -rw-r--r-- | ui/routes/+layout.svelte | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte index 18c0541..5bccd2f 100644 --- a/ui/routes/+layout.svelte +++ b/ui/routes/+layout.svelte @@ -1,14 +1,11 @@ <script> import { setContext } from 'svelte'; - import { browser } from '$app/environment'; - import { goto, onNavigate, afterNavigate } from '$app/navigation'; + import { onNavigate } from '$app/navigation'; import { page } from '$app/stores'; import '../app.css'; import logo from '$lib/assets/logo.png'; - import { STORE_KEY_LAST_ACTIVE } from '$lib/constants'; import { currentUser } from '$lib/store'; - let activeChannel = $derived($page.params.channel); let pageContext = $state({ showMenu: false @@ -20,28 +17,6 @@ pageContext.showMenu = !pageContext.showMenu; } - function getLastActiveChannel() { - return ( - browser && JSON.parse(localStorage.getItem(STORE_KEY_LAST_ACTIVE)) - ); - } - - function setLastActiveChannel(channelId) { - browser && localStorage.setItem( - STORE_KEY_LAST_ACTIVE, - JSON.stringify(channelId) - ); - } - - afterNavigate(() => { - const lastActiveChannel = getLastActiveChannel(); - if (!activeChannel && lastActiveChannel) { - goto(`/ch/${lastActiveChannel}`); - } else { - setLastActiveChannel(activeChannel || null); - } - }); - onNavigate(() => { pageContext.showMenu = false; }); |
