summaryrefslogtreecommitdiff
path: root/src/redux/preference/reducer.js
diff options
context:
space:
mode:
authorKamran Ahmed <kamranahmed.se@gmail.com>2018-08-19 21:24:13 +0400
committerKamran Ahmed <kamranahmed.se@gmail.com>2018-08-19 21:24:13 +0400
commit6ca7bd64e8253f04beb44d00644a537cfeeb74ff (patch)
tree0e5548398fe03102aabb051f487a3175b48eaee3 /src/redux/preference/reducer.js
parentRestructure and add router (diff)
downloadgithunt-6ca7bd64e8253f04beb44d00644a537cfeeb74ff.tar.gz
Add redux/redux-persist and option reducer
Diffstat (limited to 'src/redux/preference/reducer.js')
-rw-r--r--src/redux/preference/reducer.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/redux/preference/reducer.js b/src/redux/preference/reducer.js
new file mode 100644
index 0000000..a72c8b2
--- /dev/null
+++ b/src/redux/preference/reducer.js
@@ -0,0 +1,30 @@
+import { RESET_OPTIONS, UPDATE_OPTIONS, UPDATE_VIEW_TYPE } from './types';
+
+const initialState = {
+ view: 'grid',
+ options: {
+ token: '',
+ },
+};
+
+export default function reducer(state = initialState, action) {
+ switch (action.type) {
+ case UPDATE_OPTIONS:
+ return {
+ ...state,
+ options: action.payload
+ };
+ case RESET_OPTIONS:
+ return {
+ ...state,
+ options: initialState.options
+ };
+ case UPDATE_VIEW_TYPE:
+ return {
+ ...state,
+ view: action.payload
+ };
+ default:
+ return state;
+ }
+}