aboutsummaryrefslogtreecommitdiff
path: root/src/utils/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r--src/utils/users.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/users.ts b/src/utils/users.ts
index 30b9d77b..0ed490c7 100644
--- a/src/utils/users.ts
+++ b/src/utils/users.ts
@@ -1,3 +1,4 @@
+import {loadUserX} from './../store/actions/userX';
import {RootState} from './../store/rootReducer';
import AsyncStorage from '@react-native-community/async-storage';
import {AppDispatch} from './../store/configureStore';
@@ -54,6 +55,23 @@ export const userLogin = async (dispatch: AppDispatch, user: UserType) => {
};
/**
+ * This tries to load data userX passed in
+ * @param dispatch This is the dispatch object from the redux store
+ * @param user The user
+ */
+export const fetchUserX = async (
+ dispatch: AppDispatch,
+ user: UserType,
+ screenType: ScreenType,
+) => {
+ try {
+ await Promise.all([dispatch(loadUserX(user, screenType))]);
+ } catch (error) {
+ console.log(error);
+ }
+};
+
+/**
* This function checks if the userX slice of our store contains the given user for the provided Screen
*/
export const userXInStore = (