diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-09-26 14:56:02 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-09-26 14:56:02 +0200 |
| commit | a17b76ac75f506f5da6fe8adf9c36632b60d4226 (patch) | |
| tree | abb0af0c4409b830dea2ef808c146223ee973933 /frontend/app/views/tile/tile.reducer.js | |
| parent | 2231a6e1c05b07bb7ec5906716aedec93d02429c (diff) | |
refactor to use app-rooted js imports
Diffstat (limited to 'frontend/app/views/tile/tile.reducer.js')
| -rw-r--r-- | frontend/app/views/tile/tile.reducer.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/frontend/app/views/tile/tile.reducer.js b/frontend/app/views/tile/tile.reducer.js new file mode 100644 index 0000000..d327a0c --- /dev/null +++ b/frontend/app/views/tile/tile.reducer.js @@ -0,0 +1,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 + } +} |
