mirror of
https://github.com/jumpserver/lina.git
synced 2025-11-08 19:02:40 +00:00
Compare commits
3 Commits
pr@pam@sty
...
v2.2.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d186ae1f23 | ||
|
|
c5defdd835 | ||
|
|
40e7fcda2e |
@@ -65,3 +65,7 @@ export function logout() {
|
|||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function refreshSessionIdAge() {
|
||||||
|
return getProfile()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import i18n from '@/i18n/i18n'
|
import i18n from '@/i18n/i18n'
|
||||||
import { getTokenFromCookie } from '@/utils/auth'
|
import { getTokenFromCookie } from '@/utils/auth'
|
||||||
|
import { refreshSessionIdAge } from '@/api/users'
|
||||||
import { Message, MessageBox } from 'element-ui'
|
import { Message, MessageBox } from 'element-ui'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
@@ -88,6 +89,19 @@ export function flashErrorMsg({ response, error }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timer = null
|
||||||
|
function refreshSessionAgeDelay(response) {
|
||||||
|
if (response.request.responseURL.indexOf('/users/profile/') !== -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (timer) {
|
||||||
|
clearTimeout(timer)
|
||||||
|
}
|
||||||
|
timer = setTimeout(function() {
|
||||||
|
refreshSessionIdAge()
|
||||||
|
}, 60 * 10 * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
// response interceptor
|
// response interceptor
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
/**
|
/**
|
||||||
@@ -102,6 +116,7 @@ service.interceptors.response.use(
|
|||||||
*/
|
*/
|
||||||
response => {
|
response => {
|
||||||
// NProgress.done()
|
// NProgress.done()
|
||||||
|
refreshSessionAgeDelay(response)
|
||||||
const res = response.data
|
const res = response.data
|
||||||
|
|
||||||
if (response.config.raw === 1) {
|
if (response.config.raw === 1) {
|
||||||
|
|||||||
@@ -111,7 +111,9 @@ export default {
|
|||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
autosize: true
|
autosize: true
|
||||||
},
|
},
|
||||||
hidden: form => form.protocol !== 'k8s'
|
hidden: form => {
|
||||||
|
return form.protocol !== 'k8s'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
protocol: {
|
protocol: {
|
||||||
rules: [
|
rules: [
|
||||||
@@ -208,6 +210,16 @@ export default {
|
|||||||
url: '/api/v1/assets/system-users/',
|
url: '/api/v1/assets/system-users/',
|
||||||
authHiden: false
|
authHiden: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
method: {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const params = this.$route.params
|
||||||
|
const method = params.id ? 'post' : 'put'
|
||||||
|
if (method === 'post') {
|
||||||
|
this.fieldsMeta.token.rules[0].required = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user