Skip to content

Commit

Permalink
perf: revert pre org if logout
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed Aug 23, 2024
1 parent d561701 commit 95cc7bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/layout/components/NavHeader/AccountDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default {
break
case 'logout':
this.logout()
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
break
case 'apiKey':
this.$router.push('/profile/api-keys')
Expand All @@ -73,7 +72,12 @@ export default {
this.$router.push('/profile/user/setting')
}
},
logout() {
async logout() {
const currentOrg = this.$store.getters.currentOrg
if (currentOrg.autoEnter) {
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
}
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ async function checkLogin({ to, from, next }) {
} catch (e) {
Vue.$log.error(e)
const status = e.response.status
if (store.getters.currentOrg.autoEnter) {
await store.dispatch('users/setCurrentOrg', store.getters.preOrg)
}
if (status === 401 || status === 403) {
setTimeout(() => {
window.location = process.env.VUE_APP_LOGIN_PATH
Expand Down

0 comments on commit 95cc7bd

Please sign in to comment.