李志伟 3 lat temu
rodzic
commit
c46c1defd9
1 zmienionych plików z 4 dodań i 7 usunięć
  1. 4
    7
      src/components/RightContent/AvatarDropdown.jsx

+ 4
- 7
src/components/RightContent/AvatarDropdown.jsx Wyświetl plik

@@ -10,12 +10,13 @@ import styles from './index.less';
10 10
 /**
11 11
  * 退出登录,并且将当前的 url 保存
12 12
  */
13
-const loginOut = async (val) => {
13
+const loginOut = async () => {
14 14
   localStorage.removeItem('token');
15
+  let role=localStorage.getItem('roleAlias');
15 16
   const { query = {}, pathname } = history.location;
16 17
   const { redirect } = query;
17 18
   if (window.location.pathname !== '/user/login' && !redirect) {
18
-    if (val == 'org') {
19
+    if (role == 'org') {
19 20
       goPage('/user/orgLogin',pathname);      
20 21
     } else {
21 22
       goPage('/user/login',pathname);
@@ -40,11 +41,7 @@ const AvatarDropdown = ({ menu }) => {
40 41
 
41 42
       if (key === 'logout') {
42 43
         setInitialState((s) => ({ ...s, currentUser: undefined }));
43
-        if (initialState.roleAlias == 'org') {
44
-          loginOut('org');
45
-        } else {
46
-          loginOut('admin');
47
-        }
44
+        loginOut('admin');
48 45
         return;
49 46
       }
50 47