@@ -36,7 +36,7 @@ export class MacroHeaderComponent implements AfterViewInit, OnChanges {
|
||||
}
|
||||
|
||||
removeMacro() {
|
||||
this.store.dispatch(MacroActions.removeMacro(this.macro.id));
|
||||
this.store.dispatch(MacroActions.removeMacro(this.macro));
|
||||
}
|
||||
|
||||
duplicateMacro() {
|
||||
|
||||
@@ -22,10 +22,10 @@ export namespace MacroActions {
|
||||
};
|
||||
}
|
||||
|
||||
export function removeMacro(id: number): Action {
|
||||
export function removeMacro(macro: Macro): Action {
|
||||
return {
|
||||
type: MacroActions.REMOVE,
|
||||
payload: id
|
||||
payload: macro
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ export default function (state = initialState, action: Action): KeymapState {
|
||||
newState = state.entities.map((keymap: Keymap) => {
|
||||
changedKeymap = new Keymap();
|
||||
Object.assign(changedKeymap, keymap);
|
||||
changedKeymap.layers = checkExistence(changedKeymap.layers, '_macroId', action.payload);
|
||||
changedKeymap.layers = checkExistence(changedKeymap.layers, 'macro', action.payload);
|
||||
|
||||
return changedKeymap;
|
||||
});
|
||||
@@ -211,7 +211,7 @@ function generateName(keymaps: Keymap[], name: string) {
|
||||
return name;
|
||||
}
|
||||
|
||||
function checkExistence(layers: Layer[], property: string, value: string | number) {
|
||||
function checkExistence(layers: Layer[], property: string, value: any) {
|
||||
let newLayers = layers.map((layer) => {
|
||||
let newLayer = new Layer(layer);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export default function (state = initialState, action: Action): MacroState {
|
||||
};
|
||||
|
||||
case MacroActions.REMOVE:
|
||||
newState = state.entities.filter((macro: Macro) => macro.id !== action.payload);
|
||||
newState = state.entities.filter((macro: Macro) => macro !== action.payload);
|
||||
|
||||
return {
|
||||
entities: newState
|
||||
|
||||
Reference in New Issue
Block a user