diff options
Diffstat (limited to 'src/actions/firebase.js')
-rw-r--r-- | src/actions/firebase.js | 15 |
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); }); } |