Skip to content

Commit 56a310c

Browse files
committed
feat(ui): record the page path when logout
1 parent 290a798 commit 56a310c

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

cmdb-ui/src/store/global/user.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,16 @@ const user = {
184184
}).catch(() => {
185185
resolve()
186186
}).finally(() => {
187-
window.location.href = '/user/logout'
187+
let logoutURL = '/user/logout'
188+
const fullPath = window.location.pathname + window.location.search
189+
if (
190+
fullPath &&
191+
fullPath !== '/'
192+
) {
193+
logoutURL += `?redirect=${fullPath}`
194+
}
195+
196+
window.location.href = logoutURL
188197
})
189198
})
190199
},

cmdb-ui/src/views/user/Logout.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ export default {
6464
await this.GetAuthDataEnable()
6565
this.loading = false
6666
if (!this._enable_list.length || this._enable_list.length > 1) {
67-
this.$router.push('/user/login')
67+
let loginURL = '/user/login'
68+
const redirect = this.$route?.query?.redirect
69+
if (redirect) {
70+
loginURL += `?redirect=${redirect}`
71+
}
72+
73+
this.$router.push(loginURL)
6874
}
6975
if (this.auth_auto_redirect) {
7076
this.time = 0

0 commit comments

Comments
 (0)