| @@ -16,7 +16,7 @@ import { MaterialIcons } from "@expo/vector-icons"; | |||
| import { Ionicons } from "@expo/vector-icons"; | |||
| import { useDispatch } from "react-redux"; | |||
| import { logoutUser } from "../../store/actions/login/loginActions"; | |||
| import useAuthHook from "../../utils/hooks/useAuthHook"; | |||
| import useAuthHook from "../../hooks/useAuthHook"; | |||
| const CustomDrawer = (props) => { | |||
| @@ -1,9 +1,9 @@ | |||
| import React from "react"; | |||
| import * as Google from "expo-auth-session/providers/google"; | |||
| import { getData } from "../../service/asyncStorage"; | |||
| import { ACCESS_TOKEN } from "../../constants/localStorage"; | |||
| import { getData } from "../service/asyncStorage"; | |||
| import { ACCESS_TOKEN } from "../constants/localStorage"; | |||
| import { revokeAsync } from "expo-auth-session"; | |||
| import variables from "../variables"; | |||
| import variables from "../utils/variables"; | |||
| const useAuthHook = () => { | |||
| const [request, response, promptAsync] = Google.useAuthRequest({ | |||
| @@ -29,7 +29,7 @@ import { | |||
| import { selectIsLoadingByActionType } from "../store/selectors/loadingSelectors"; | |||
| import { LOGIN_USER_SCOPE } from "../store/actions/login/loginActionConstants"; | |||
| import { fetchAuthProvider } from "../store/actions/authProvider/authProviderActions"; | |||
| import useAuthHook from "../utils/hooks/useAuthHook"; | |||
| import useAuthHook from "../hooks/useAuthHook"; | |||
| import { storeData } from "../service/asyncStorage"; | |||
| import { ACCESS_TOKEN } from "../constants/localStorage"; | |||
| @@ -33,7 +33,7 @@ import { | |||
| clearRegisterErrors, | |||
| registerUser, | |||
| } from "../store/actions/register/registerActions"; | |||
| import useAuthHook from "../utils/hooks/useAuthHook"; | |||
| import useAuthHook from "../hooks/useAuthHook"; | |||
| import { fetchAuthProvider } from "../store/actions/authProvider/authProviderActions"; | |||
| import { ACCESS_TOKEN } from "../constants/localStorage"; | |||
| import { storeData } from "../service/asyncStorage"; | |||
| @@ -1,10 +1,16 @@ | |||
| import React from 'react'; | |||
| import { View, Text, StyleSheet } from 'react-native'; | |||
| import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; | |||
| const SettingsScreen = () => { | |||
| const SettingsScreen = ({navigation}) => { | |||
| return ( | |||
| <View style={styles.container}> | |||
| <Text>Settings</Text> | |||
| <TouchableOpacity onPress={() => navigation.goBack()}> | |||
| <Text>Go Back</Text> | |||
| </TouchableOpacity> | |||
| <TouchableOpacity onPress={() => navigation.openDrawer()}> | |||
| <Text>Open drawer</Text> | |||
| </TouchableOpacity> | |||
| </View> | |||
| ) | |||
| } | |||
| @@ -5,26 +5,24 @@ import { | |||
| SUCCESS, | |||
| UPDATE, | |||
| SUBMIT, | |||
| } from '../actions/actionHelpers'; | |||
| import { addLoader, removeLoader } from '../actions/app/appActions'; | |||
| } from "../actions/actionHelpers"; | |||
| import { addLoader, removeLoader } from "../actions/app/appActions"; | |||
| const promiseTypes = [FETCH, UPDATE, DELETE, SUBMIT]; | |||
| export default ({ dispatch }) => (next) => (action) => { | |||
| const promiseType = promiseTypes.find((promiseType) => | |||
| action.type.includes(promiseType), | |||
| ); | |||
| if (promiseType) { | |||
| dispatch(addLoader(action.type)); | |||
| return next(action); | |||
| } | |||
| export default ({ dispatch }) => | |||
| (next) => | |||
| (action) => { | |||
| const promiseType = promiseTypes.find((promiseType) => | |||
| action.type.includes(promiseType) | |||
| ); | |||
| if (promiseType) { | |||
| dispatch(addLoader(action.type)); | |||
| return next(action); | |||
| } | |||
| if (action.type.includes(SUCCESS) || action.type.includes(ERROR)) { | |||
| // const actionType = action.type.includes(SUCCESS) | |||
| // ? action.type.replace(SUCCESS, '[LOADING]') | |||
| // : action.type.replace(ERROR, '[LOADING]'); | |||
| dispatch(removeLoader(action.type)); | |||
| return next(action); | |||
| } | |||
| next(action); | |||
| }; | |||
| if (action.type.includes(SUCCESS) || action.type.includes(ERROR)) { | |||
| dispatch(removeLoader(action.type)); | |||
| return next(action); | |||
| } | |||
| next(action); | |||
| }; | |||