Cleaned up login/logout flows.

This commit is contained in:
Leo Vasanko
2025-09-02 19:08:16 -06:00
parent 10e55f63b5
commit b324276173
8 changed files with 46 additions and 18 deletions
+5 -4
View File
@@ -8,7 +8,7 @@ export const useAuthStore = defineStore('auth', {
settings: null, // Server provided settings (/auth/settings)
isLoading: false,
resetToken: null, // transient reset token
restrictedMode: false, // If true, app loaded outside /auth/ and should restrict to login or permission denied
restrictedMode: false, // Anywhere other than /auth/: restrict to login or permission denied
// UI State
currentView: 'login',
@@ -129,12 +129,13 @@ export const useAuthStore = defineStore('auth', {
},
async logout() {
try {
await fetch('/auth/api/logout', {method: 'POST'})
await fetch('/auth/api/logout', {method: 'POST'})
this.userInfo = null
if (this.restrictedMode) location.reload()
} catch (error) {
console.error('Logout error:', error)
this.showMessage(error.message, 'error')
}
this.userInfo = null
},
}
})