summaryrefslogtreecommitdiff
path: root/src/reducers/topology.js
blob: c86908166c4d4ef1879b747c5b024ff4a0440b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import {
    CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED,
    FETCH_LATEST_DATACENTER_SUCCEEDED,
    FINISH_NEW_ROOM_CONSTRUCTION,
    START_NEW_ROOM_CONSTRUCTION_SUCCEEDED
} from "../actions/topology";

export function currentDatacenterId(state = -1, action) {
    switch (action.type) {
        case FETCH_LATEST_DATACENTER_SUCCEEDED:
            return action.datacenterId;
        default:
            return state;
    }
}

export function currentRoomInConstruction(state = -1, action) {
    switch (action.type) {
        case START_NEW_ROOM_CONSTRUCTION_SUCCEEDED:
            return action.roomId;
        case CANCEL_NEW_ROOM_CONSTRUCTION_SUCCEEDED:
        case FINISH_NEW_ROOM_CONSTRUCTION:
            return -1;
        default:
            return state;
    }
}