aboutsummaryrefslogtreecommitdiff
path: root/src/reducers/firebase.js
diff options
context:
space:
mode:
authorMichael Foiani <mfoiani2019@communityschoolnaples.org>2018-07-26 11:05:32 -0400
committerMichael Foiani <mfoiani2019@communityschoolnaples.org>2018-07-26 11:05:32 -0400
commitc8455753523c47d95e0438a0c4999b77d4f6fa47 (patch)
treead6360cb2aa7f4688a910403d9f7ba08e62c1651 /src/reducers/firebase.js
parentf0815df6642642db3e5063b6800d2ed0f681754c (diff)
Added basic sign out feature and realtime query for tutoring hours.
Diffstat (limited to 'src/reducers/firebase.js')
-rw-r--r--src/reducers/firebase.js39
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;