summaryrefslogtreecommitdiff
path: root/frontend/src/containers/UserRepo
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/UserRepo')
-rw-r--r--frontend/src/containers/UserRepo/actions.js8
-rw-r--r--frontend/src/containers/UserRepo/reducer.js18
2 files changed, 26 insertions, 0 deletions
diff --git a/frontend/src/containers/UserRepo/actions.js b/frontend/src/containers/UserRepo/actions.js
new file mode 100644
index 00000000..dc06035b
--- /dev/null
+++ b/frontend/src/containers/UserRepo/actions.js
@@ -0,0 +1,8 @@
+export const SET_USERNAME = 'homePage/SET_USERNAME'
+
+export const setUsername = (userName, displayName, index) => ({
+ type: SET_USERNAME,
+ userName,
+ index,
+ displayName
+})
diff --git a/frontend/src/containers/UserRepo/reducer.js b/frontend/src/containers/UserRepo/reducer.js
new file mode 100644
index 00000000..82960a58
--- /dev/null
+++ b/frontend/src/containers/UserRepo/reducer.js
@@ -0,0 +1,18 @@
+import { SET_USERNAME } from './actions'
+import { fromJS } from 'immutable'
+const initialState = fromJS({
+ username: '',
+ displayName: '',
+ id: null
+})
+
+export default (state = initialState, action) => {
+ switch (action.type) {
+ case SET_USERNAME:
+ return state.set('username', action.userName)
+ .set('displayName', action.displayName)
+ .set('id', action.index)
+ default:
+ return state
+ }
+}
bgstack15