aboutsummaryrefslogtreecommitdiff
path: root/src/actions/firebaseAdmin.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/firebaseAdmin.js')
-rw-r--r--src/actions/firebaseAdmin.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/actions/firebaseAdmin.js b/src/actions/firebaseAdmin.js
index 5c8bfca..6009d46 100644
--- a/src/actions/firebaseAdmin.js
+++ b/src/actions/firebaseAdmin.js
@@ -3,6 +3,7 @@ import { firestore, fireStorage } from '../firebase.js';
export const UPDATE_ADMIN = 'UPDATE_ADMIN';
export const UPDATE_ADMIN_REQUESTS = 'UPDATE_ADMIN_REQUESTS';
export const UPDATE_ADMIN_COMP_LIST = 'UPDATE_ADMIN_COMP_LIST';
+export const UPDATE_ADMIN_USER_LIST = 'UPDATE_ADMIN_USER_LIST';
export const updateAdmin = (status) => {
return {
@@ -25,12 +26,20 @@ export const updateAdminCompList = (compList) => {
}
}
+export const updateAdminUserList = (userList) => {
+ return {
+ type: UPDATE_ADMIN_USER_LIST,
+ payload: userList
+ }
+}
+
//Middleware to update dispatches
export const adminControls = () => (dispatch) => {
dispatch(updateAdmin(true));
dispatch(snapshotAdminRequests());
dispatch(snapshotAdminCompList());
+ dispatch(snapshotAdminUserList());
}
export const snapshotAdminRequests = () => (dispatch) => {
@@ -69,10 +78,22 @@ export const snapshotAdminCompList = () => (dispatch) => {
});
}
+export const snapshotAdminUserList = () => (dispatch) => {
+ var docRef = firestore.collection('users');
+ docRef.onSnapshot((querySnapshot) => {
+ var userList = [];
+ querySnapshot.forEach((doc) => {
+ userList.push(doc);
+ });
+ dispatch(updateAdminUserList(userList));
+ });
+}
+
export const adminClose = () => (dispatch) => {
dispatch(updateAdmin(false));
dispatch(updateAdminRequests([]));
dispatch(updateAdminCompList([]));
+ dispatch(updateAdminUserList([]));
}
export const adminRejectHours = (_id, _path) => (dispatch) => {