aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-08-02 12:44:06 -0400
committerMichael Foiani <mfoiani2019@communiyschoolnaples.org>2018-08-02 12:44:06 -0400
commit9760f71b0d53daa1753fb31562aba61a0808912a (patch)
treee9d64a302ad109a045656d9bfcfaa935e1f9c856
parent5845a05a46b177fc26350d3c2a30f728c4bf4483 (diff)
Fixed small bug with updating approvedhours with new security settings.
-rw-r--r--src/actions/firebase.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/actions/firebase.js b/src/actions/firebase.js
index 21757ae..49d6768 100644
--- a/src/actions/firebase.js
+++ b/src/actions/firebase.js
@@ -300,19 +300,18 @@ export const updateAdminRequests = (requests) => {
export const adminApproveHours = (_uid, _time, _id) => (dispatch) => {
- var docRef = firestore.collection('users').doc(_uid);
- var currentApprHours = 0;
+ var docRef = firestore.collection('users').doc(_uid);
docRef.get().then((doc) => {
if(doc.exists) {
- currentApprHours = doc.data().hours;
+ docRef.update({
+ hours: (doc.data().hours + _time)
+ }).catch((error) => {
+ alert(error);
+ });
}
});
- docRef.update({
- hours: (currentApprHours + _time)
- });
-
dispatch(adminDeleteRequest(_id));
}
@@ -323,7 +322,7 @@ export const adminRejectHours = (_id) => (dispatch) => {
export const adminDeleteRequest = (_id) => (dispatch) => {
var docRef = firestore.collection('requests').doc(_id);
docRef.delete().then(() => {
- console.log('Deleted request with id ' + _id);
+ //console.log('Deleted request with id ' + _id);
});
}