🐛fix(session): The localStorage did not clear user information after the login session expired
This commit is contained in:
@@ -95,6 +95,8 @@ export function showError(error) {
|
|||||||
if (error.name === 'AxiosError') {
|
if (error.name === 'AxiosError') {
|
||||||
switch (error.response.status) {
|
switch (error.response.status) {
|
||||||
case 401:
|
case 401:
|
||||||
|
// 清除用户状态
|
||||||
|
localStorage.removeItem('user');
|
||||||
// toast.error('错误:未登录或登录已过期,请重新登录!', showErrorOptions);
|
// toast.error('错误:未登录或登录已过期,请重新登录!', showErrorOptions);
|
||||||
window.location.href = '/login?expired=true';
|
window.location.href = '/login?expired=true';
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user