Clear all stores after logout
This commit is contained in:
parent
9d41520521
commit
b946ac2bc4
|
|
@ -75,10 +75,14 @@ const initStores = (): StoreMapping => {
|
|||
stores.messagesStore.publishSingleMessage(message);
|
||||
Notifications.notifyNewMessage(message);
|
||||
});
|
||||
stores.appStore.refresh();
|
||||
} else {
|
||||
stores.messagesStore.clearAll();
|
||||
stores.appStore.clear();
|
||||
stores.clientStore.clear();
|
||||
stores.userStore.clear();
|
||||
stores.wsStore.close();
|
||||
}
|
||||
stores.appStore.refresh();
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ export class MessagesStore {
|
|||
this.snack('Message deleted');
|
||||
};
|
||||
|
||||
@action
|
||||
public clearAll = () => {
|
||||
this.state = {};
|
||||
this.createEmptyStatesForApps(this.appStore.getItems());
|
||||
};
|
||||
|
||||
public exists = (id: number) => this.stateOf(id).loaded;
|
||||
|
||||
private removeFromList(messages: IMessage[], messageToDelete: IMessage): false | number {
|
||||
|
|
@ -106,11 +112,6 @@ export class MessagesStore {
|
|||
return false;
|
||||
}
|
||||
|
||||
private clearAll = () => {
|
||||
this.state = {};
|
||||
this.createEmptyStatesForApps(this.appStore.getItems());
|
||||
};
|
||||
|
||||
private clear = (appId: number) => (this.state[appId] = this.emptyState());
|
||||
|
||||
private fetchMessages = (
|
||||
|
|
|
|||
Loading…
Reference in New Issue