Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ff051fbb5 | ||
|
|
0d7059fcf6 |
15
resources/scripts/admin/stores/auth.js
vendored
15
resources/scripts/admin/stores/auth.js
vendored
@@ -46,20 +46,29 @@ export const useAuthStore = (useWindow = false) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http
|
||||
.post('/auth/logout')
|
||||
.then((response) => {
|
||||
.then(async (response) => {
|
||||
const notificationStore = useNotificationStore()
|
||||
notificationStore.showNotification({
|
||||
type: 'success',
|
||||
message: 'Logged out successfully.',
|
||||
})
|
||||
|
||||
// Clear stored auth data so next login doesn't send stale tokens
|
||||
window.Ls.remove('auth.token')
|
||||
window.Ls.remove('selectedCompany')
|
||||
|
||||
// Refresh CSRF token so next login works cleanly
|
||||
await http.get('/sanctum/csrf-cookie').catch(() => {})
|
||||
|
||||
window.router.push('/login')
|
||||
// resetStore.clearPinia()
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
handleError(err)
|
||||
window.router.push('/')
|
||||
window.Ls.remove('auth.token')
|
||||
window.Ls.remove('selectedCompany')
|
||||
http.get('/sanctum/csrf-cookie').catch(() => {})
|
||||
window.router.push('/login')
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -34,6 +34,9 @@ Route::post('login', [LoginController::class, 'login']);
|
||||
|
||||
Route::post('auth/logout', function () {
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
request()->session()->invalidate();
|
||||
request()->session()->regenerateToken();
|
||||
});
|
||||
|
||||
// Customer auth
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.2.1
|
||||
2.3.0
|
||||
|
||||
Reference in New Issue
Block a user