summaryrefslogtreecommitdiff
path: root/client/nameSearch/nameSearch.reducer.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/nameSearch/nameSearch.reducer.js')
-rw-r--r--client/nameSearch/nameSearch.reducer.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/nameSearch/nameSearch.reducer.js b/client/nameSearch/nameSearch.reducer.js
new file mode 100644
index 00000000..101c93ea
--- /dev/null
+++ b/client/nameSearch/nameSearch.reducer.js
@@ -0,0 +1,32 @@
+import * as types from '../types'
+
+const initialState = () => ({
+ query: {},
+ result: {},
+ loading: false,
+})
+
+export default function nameSearchReducer(state = initialState(), action) {
+ switch (action.type) {
+ case types.nameSearch.loading:
+ return {
+ ...state,
+ [action.tag]: { loading: true },
+ }
+
+ case types.nameSearch.loaded:
+ return {
+ ...state,
+ [action.tag]: action.data,
+ }
+
+ case types.nameSearch.error:
+ return {
+ ...state,
+ [action.tag]: { error: action.err },
+ }
+
+ default:
+ return state
+ }
+}