mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-18 08:12:33 +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 }) {
|
||||
if (!response.config.disableFlashErrorMsg) {
|
||||
const responseErrorMsg = getErrorResponseMsg(error)
|
||||
const msg = responseErrorMsg || error.message
|
||||
|
||||
if (response.status === 403 && msg === 'CSRF Failed: CSRF token missing.') {
|
||||
setTimeout(() => { logout() }, 1000)
|
||||
}
|
||||
message({
|
||||
message: msg,
|
||||
type: 'error',
|
||||
|
Reference in New Issue
Block a user