feat: redirect unauthenticated users from profile pages to home, fix auth timing on page refresh

This commit is contained in:
2026-02-04 14:31:25 +01:00
parent 7f40dc1e9b
commit 0830af9c0e
5 changed files with 43 additions and 31 deletions

View File

@@ -9,6 +9,12 @@ class PageSettings extends HTMLElement {
connectedCallback() {
this.isLoggedIn = auth.isLoggedIn()
if (!this.isLoggedIn) {
window.location.hash = '#/'
return
}
this.render()
this.setupEventListeners()
@@ -19,8 +25,10 @@ class PageSettings extends HTMLElement {
this.authUnsubscribe = auth.subscribe(() => {
this.isLoggedIn = auth.isLoggedIn()
this.render()
this.setupEventListeners()
if (!this.isLoggedIn) {
window.location.hash = '#/'
}
})
}