blob: af258a6f06c6c74a4078ac41b6d8e981c526c4f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import {goDownOneInteractionLevel} from "../interaction-level";
import {addPropToStoreObject} from "../objects";
export const DELETE_MACHINE = "DELETE_MACHINE";
export function deleteMachine() {
return {
type: DELETE_MACHINE
};
}
export function deleteMachineSucceeded() {
return (dispatch, getState) => {
const {interactionLevel, objects} = getState();
const rack = objects.rack[objects.tile[interactionLevel.tileId].objectId];
const machineIds = [...rack.machineIds];
machineIds[interactionLevel.position - 1] = null;
dispatch(goDownOneInteractionLevel());
dispatch(addPropToStoreObject("rack", rack.id, {machineIds}));
};
}
|