Browse Source

退登时,清空消息队列

main
zhengzhou 3 years ago
parent
commit
a8e5abfd18
2 changed files with 8 additions and 2 deletions
  1. +3
    -2
      src/services/user.ts
  2. +5
    -0
      src/utils/hooks.ts

+ 3
- 2
src/services/user.ts View File

@@ -1,10 +1,10 @@
import { history } from 'umi';
import { fetchApi } from '@/utils/request';
import storage from '@/utils/storage';
import { errorReponse, firstCharToLowerCase, isReqSuccess } from '@/utils/tool';
import { propertyOf } from 'lodash';
import { errorReponse, isReqSuccess } from '@/utils/tool';
import system from './system';
import { DATA } from './API';
import { fileMng } from '@/utils/hooks';

export async function queryCurrent() {
const accountId = storage.get('accountId');
@@ -77,6 +77,7 @@ export function logout(clearStorage = true) {
if (clearStorage) {
storage.clear();
}
fileMng.clear();
system.logout();
// window.location.href = '/login';
history.replace('/login');


+ 5
- 0
src/utils/hooks.ts View File

@@ -45,6 +45,11 @@ class FileMessageManager extends Subject {
);
this.notifyObservers(this.list);
}
clear() {
this.list = [];
this.fileMap = new Map();
this.notifyObservers(this.list);
}
receiveMessage(messageStr: string) {
try {
const message = firstCharToLowerCase(


Loading…
Cancel
Save