Skip to content

Commit 90ccc78

Browse files
committed
fixed infinite logout loop
1 parent eb1da77 commit 90ccc78

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

resources/js/layouts/App.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@ export default {
1919
console.error(error)
2020
if (error.response.status === 401 || error.response.status === 419) {
2121
if (error.response.data.message === 'CSRF token mismatch.') return
22+
23+
if (error.response.status === 401 && error.config.url === '/logout') {
24+
router.replace({ name: 'Login' })
25+
return
26+
}
27+
2228
this.logout()
2329
.catch((error) => { console.error(error) })
30+
2431
router.replace({ name: 'Login' })
2532
} else if (error.response.status === 403) {
2633
router.push({ name: 'VerifyEmail' })

resources/js/stores/auth.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export const useAuthStore = defineStore('auth', {
2828
console.error(error)
2929
throw error
3030
})
31+
.finally(() => {
32+
this.$reset()
33+
})
3134
},
3235
},
3336
getters: {

0 commit comments

Comments
 (0)