summaryrefslogtreecommitdiff
path: root/frontend/views/tile/tile.reducer.js
blob: a4e58685d764b0b7175ff1a265b9f61d5d915ca1 (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
32
import * as types from '../../types'
// import { session, getDefault, getDefaultInt } from '../../session'

import { crudState, crudReducer } from '../../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
  }
}