diff --git a/src/utils/request.js b/src/utils/request.js index 4aa6fac41..985c1b767 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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',