From a17b76ac75f506f5da6fe8adf9c36632b60d4226 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 26 Sep 2020 14:56:02 +0200 Subject: refactor to use app-rooted js imports --- frontend/app/views/tile/tile.reducer.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 frontend/app/views/tile/tile.reducer.js (limited to 'frontend/app/views/tile/tile.reducer.js') 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 + } +} -- cgit v1.2.3-70-g09d2