feat: redirect unauthenticated users from profile pages to home, fix auth timing on page refresh
This commit is contained in:
@@ -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 = '#/'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user