优化登录验证、退出逻辑

This commit is contained in:
whyour
2021-03-26 23:57:31 +08:00
parent 9fd678a7fc
commit 7ba3e59980
5 changed files with 98 additions and 7 deletions
+5 -2
View File
@@ -11,12 +11,15 @@ import { Link, history } from 'umi';
import { LogoutOutlined } from '@ant-design/icons';
import config from '@/utils/config';
import 'codemirror/mode/shell/shell.js';
import { request } from '@/utils/http';
import './index.less';
export default function (props: any) {
const logout = () => {
localStorage.removeItem(config.authKey);
history.push('/login');
request.post(`${config.apiPrefix}logout`).then(() => {
localStorage.removeItem(config.authKey);
history.push('/login');
});
};
useEffect(() => {