mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
fix: reset user profile on logout
This commit is contained in:
1 parent
89f86fad30
commit
e360ebcf53
2 files changed
+6
-2
No files matched your search
@@ -5,7 +5,10 @@ import { useToast } from 'vue-toastification'
|
|||||||
import { logout } from '../utils/auth'
|
import { logout } from '../utils/auth'
|
||||||
import { bugReportUrl } from '../config'
|
import { bugReportUrl } from '../config'
|
||||||
import { reset } from '../store/session'
|
import { reset } from '../store/session'
|
||||||
import userProfileStore, { loadUserProfile } from '../store/userProfile'
|
import userProfileStore, {
|
||||||
|
loadUserProfile,
|
||||||
|
resetUserProfile,
|
||||||
|
} from '../store/userProfile'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@@ -14,6 +17,7 @@ const toast = useToast()
|
|||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
try {
|
try {
|
||||||
await logout()
|
await logout()
|
||||||
|
resetUserProfile()
|
||||||
reset()
|
reset()
|
||||||
router.push({ name: 'login' })
|
router.push({ name: 'login' })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export async function loadUserProfile() {
|
|||||||
return store
|
return store
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
throw new Error('Failed to load user profile', err)
|
throw new Error(`Failed to load user profile: ${err.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user