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