aboutsummaryrefslogtreecommitdiff
path: root/src/actions/firebaseFirestore.js
diff options
context:
space:
mode:
authorMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-09-15 13:30:34 -0400
committerMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-09-15 13:30:34 -0400
commit0d6ea57b2b58111110f3a578b8ac7a14772d809b (patch)
tree447c6b0f64b881cee59a12c0c50ec8b3a080cdac /src/actions/firebaseFirestore.js
parent7073f6545544277673c0806606834225907797d7 (diff)
Created basic fix for new accounts to update username info when creatiing account.
Diffstat (limited to 'src/actions/firebaseFirestore.js')
-rw-r--r--src/actions/firebaseFirestore.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/actions/firebaseFirestore.js b/src/actions/firebaseFirestore.js
index 49e79c7..4234f4a 100644
--- a/src/actions/firebaseFirestore.js
+++ b/src/actions/firebaseFirestore.js
@@ -94,15 +94,19 @@ export const snapshotForums = () => (dispatch) => {
//Do not dipatch to store, only update firebaseFirestore
-export const setUserData = (_divison) => (dispatch, getState) => {
+export const setUserData = (_email, _password,_divison) => (dispatch, getState) => {
const uid = getState().firebaseAuth.uid;
var docRef = firestore.collection('users').doc(uid);
docRef.set({
hours: 0,
- divison: _divison
- }).catch((error) => {
- console.log(error);
+ divison: _divison,
+ username: _email.replace('@communityschoolnaples.org', '')
+ }).then(() => {
+ dispatch(signIn(_email, _password));
})
+ .catch((error) => {
+ console.log(error);
+ });
}
export const requestHours = (_time, _trainee, _location, _subject, _date, _pictureName) => (dispatch, getState) => {