summaryrefslogtreecommitdiff
path: root/frontend/app/views/tile/tile.reducer.js
blob: d327a0c074127ebb29dea86b591c85c4ca9db6c5 (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
28
29
30
31
import * as types from 'app/types'

import { crudState, crudReducer } from 'app/api/crud.reducer'

const initialState = crudState('tile', {
  temporaryTile: null,
  options: {},
})

const reducer = crudReducer('tile')

export default function tileReducer(state = initialState, action) {
  // console.log(action.type, action)
  state = reducer(state, action)
  switch (action.type) {
    case types.tile.update_temporary_tile:
      return {
        ...state,
        temporaryTile: action.data
      }

    case types.tile.clear_temporary_tile:
      return {
        ...state,
        temporaryTile: null
      }

    default:
      return state
  }
}