Support modifying the primary allocation for a server
This commit is contained in:
parent
bfb28f949d
commit
fc9054312d
17 changed files with 230 additions and 87 deletions
|
@ -5,6 +5,7 @@ export interface FlashStore {
|
|||
items: FlashMessage[];
|
||||
addFlash: Action<FlashStore, FlashMessage>;
|
||||
addError: Action<FlashStore, { message: string; key?: string }>;
|
||||
clearAndAddError: Action<FlashStore, { message: string, key: string }>;
|
||||
clearFlashes: Action<FlashStore, string | void>;
|
||||
}
|
||||
|
||||
|
@ -18,12 +19,19 @@ export interface FlashMessage {
|
|||
|
||||
const flashes: FlashStore = {
|
||||
items: [],
|
||||
|
||||
addFlash: action((state, payload) => {
|
||||
state.items.push(payload);
|
||||
}),
|
||||
|
||||
addError: action((state, payload) => {
|
||||
state.items.push({ type: 'error', title: 'Error', ...payload });
|
||||
}),
|
||||
|
||||
clearAndAddError: action((state, payload) => {
|
||||
state.items = [ { type: 'error', title: 'Error', ...payload } ];
|
||||
}),
|
||||
|
||||
clearFlashes: action((state, payload) => {
|
||||
state.items = payload ? state.items.filter(flashes => flashes.key !== payload) : [];
|
||||
}),
|
||||
|
|
Reference in a new issue