chroe: adjust logout
This commit is contained in:
+3
-1
@@ -1,5 +1,6 @@
|
|||||||
// request.js
|
// request.js
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { usePageState } from '../store/page_sate';
|
import { usePageState } from '../store/page_sate';
|
||||||
import { CONSTANT } from '../constant';
|
import { CONSTANT } from '../constant';
|
||||||
@@ -79,11 +80,12 @@ const handleException = (error) => {
|
|||||||
|
|
||||||
// 登出系统
|
// 登出系统
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
|
const router = useRouter();
|
||||||
const pageState = usePageState();
|
const pageState = usePageState();
|
||||||
pageState.setIsLogin(false);
|
pageState.setIsLogin(false);
|
||||||
localStorage.removeItem(CONSTANT.STORE_TOKEN_NAME);
|
localStorage.removeItem(CONSTANT.STORE_TOKEN_NAME);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '/login';
|
router.push('/login');
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user