perf: 优化user secret key 处理逻辑

This commit is contained in:
feng 2024-03-13 18:57:47 +08:00 committed by Bryan
parent 7b990a264f
commit fd64e71a3b
2 changed files with 20 additions and 1 deletions

View File

@ -12,7 +12,6 @@ export function getProfile(token) {
return request({
url: '/api/v1/users/profile/',
method: 'get'
// params: { token }
})
}

View File

@ -22,6 +22,7 @@ import ECharts from 'vue-echarts'
import service from '@/utils/request'
import { message } from '@/utils/message'
import xss from '@/utils/xss'
import request from '@/utils/request'
import ElTableTooltipPatch from '@/utils/elTableTooltipPatch.js'
/**
@ -70,6 +71,7 @@ Vue.prototype.$xss = xss
// 注册全局事件总线
Vue.prototype.$eventBus = eventBus
new Vue({
el: '#app',
i18n,
@ -77,3 +79,21 @@ new Vue({
store,
render: h => h(App)
})
;(function() {
request({
url: '/api/v1/authentication/user-session/',
method: 'get'
})
})()
let IdBeforeunload = false
window.addEventListener('beforeunload', (event) => {
if (IdBeforeunload) return
IdBeforeunload = true
request({
url: '/api/v1/authentication/user-session/',
method: 'delete'
})
})