diff options
Diffstat (limited to 'src/reducers/firebase.js')
-rw-r--r-- | src/reducers/firebase.js | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/src/reducers/firebase.js b/src/reducers/firebase.js index 2c7ba56..6f02c69 100644 --- a/src/reducers/firebase.js +++ b/src/reducers/firebase.js @@ -8,25 +8,46 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ -import { AUTH_FAIL, AUTH_SUCCESS } from '../actions/firebase.js'; +import { + AUTH_FAIL, + AUTH_SUCCESS, + AUTH_SIGN_OUT, + UPDATE_HOURS +} +from '../actions/firebase.js'; -const firebase = (state = {initialized: false}, action) => { +const firebase = (state = {initialized: false, authMessage: "", hours: -1, uid: null}, action) => { switch (action.type) { case AUTH_SUCCESS: - alert(action.payload); return { ...state, - initialized: action.payload + initialized: action.payload, + authMessage: action.code, + uid: action.uid }; - break; + break; case AUTH_FAIL: - alert(action.payload); return { ...state, - initialized: action.payload - }; - break; + authMessage: action.code + } + break; + + case AUTH_SIGN_OUT: + return { + ...state, + initialized: action.payload, + authMessage: action.code + } + break; + + case UPDATE_HOURS: + return { + ...state, + hours: action.payload + } + break; default: return state; |