mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
perf: Re-login after csrf expires
This commit is contained in:
@@ -89,10 +89,18 @@ function ifBadRequest({ response, error }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logout() {
|
||||||
|
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${router.fullPath}`
|
||||||
|
}
|
||||||
|
|
||||||
export function flashErrorMsg({ response, error }) {
|
export function flashErrorMsg({ response, error }) {
|
||||||
if (!response.config.disableFlashErrorMsg) {
|
if (!response.config.disableFlashErrorMsg) {
|
||||||
const responseErrorMsg = getErrorResponseMsg(error)
|
const responseErrorMsg = getErrorResponseMsg(error)
|
||||||
const msg = responseErrorMsg || error.message
|
const msg = responseErrorMsg || error.message
|
||||||
|
|
||||||
|
if (response.status === 403 && msg === 'CSRF Failed: CSRF token missing.') {
|
||||||
|
setTimeout(() => { logout() }, 1000)
|
||||||
|
}
|
||||||
message({
|
message({
|
||||||
message: msg,
|
message: msg,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
Reference in New Issue
Block a user