Clear messages on application delete
This commit is contained in:
parent
985c7cf870
commit
887328ee65
|
|
@ -5,6 +5,8 @@ import {action} from 'mobx';
|
|||
import {SnackReporter} from '../snack/SnackManager';
|
||||
|
||||
export class AppStore extends BaseStore<IApplication> {
|
||||
public onDelete: () => void = () => {};
|
||||
|
||||
public constructor(private readonly snack: SnackReporter) {
|
||||
super();
|
||||
}
|
||||
|
|
@ -16,9 +18,10 @@ export class AppStore extends BaseStore<IApplication> {
|
|||
};
|
||||
|
||||
protected requestDelete = (id: number): Promise<void> => {
|
||||
return axios
|
||||
.delete(`${config.get('url')}application/${id}`)
|
||||
.then(() => this.snack('Application deleted'));
|
||||
return axios.delete(`${config.get('url')}application/${id}`).then(() => {
|
||||
this.onDelete();
|
||||
return this.snack('Application deleted');
|
||||
});
|
||||
};
|
||||
|
||||
@action
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ const initStores = (): StoreMapping => {
|
|||
const currentUser = new CurrentUser(snackManager.snack);
|
||||
const clientStore = new ClientStore(snackManager.snack);
|
||||
const wsStore = new WebSocketStore(snackManager.snack, currentUser);
|
||||
appStore.onDelete = () => messagesStore.clearAll();
|
||||
|
||||
return {
|
||||
appStore,
|
||||
|
|
|
|||
Loading…
Reference in New Issue