aboutsummaryrefslogtreecommitdiff
path: root/src/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/onboarding/Login.tsx12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx
index 2db039c1..4d1fb09a 100644
--- a/src/screens/onboarding/Login.tsx
+++ b/src/screens/onboarding/Login.tsx
@@ -13,7 +13,7 @@ import {
TouchableOpacity,
} from 'react-native';
import SplashScreen from 'react-native-splash-screen';
-import {useDispatch} from 'react-redux';
+import {useDispatch, useSelector} from 'react-redux';
import {Background, TaggInput, TaggSquareButton} from '../../components';
import {LOGIN_ENDPOINT, usernameRegex} from '../../constants';
import {
@@ -25,6 +25,7 @@ import {
} from '../../constants/strings';
import {OnboardingStackParams} from '../../routes/onboarding';
import {fcmService} from '../../services';
+import {RootState} from '../../store/rootReducer';
import {BackgroundGradientType, UserType} from '../../types';
import {normalize, userLogin} from '../../utils';
@@ -45,11 +46,6 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
// ref for focusing on input fields
const inputRef = useRef();
- const NO_USER: UserType = {
- userId: '',
- username: '',
- };
-
// login form state
const [form, setForm] = React.useState({
username: '',
@@ -59,7 +55,7 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
attemptedSubmit: false,
token: '',
});
- const [user, setUser] = useState<UserType>(NO_USER);
+ const {newVersionAvailable} = useSelector((state: RootState) => state.user);
/**
* Redux Store stuff
@@ -167,7 +163,6 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
userLogin(dispatch, {userId: data.UserID, username});
fcmService.sendFcmTokenToServer();
} catch (err) {
- setUser(NO_USER);
console.log(data);
Alert.alert(ERROR_INVALID_LOGIN);
}
@@ -216,6 +211,7 @@ const Login: React.FC<LoginProps> = ({navigation}: LoginProps) => {
style={styles.container}
gradientType={BackgroundGradientType.Light}>
<StatusBar barStyle="light-content" />
+ {/* <Modal visible={newVersionAvailable} /> */}
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={styles.keyboardAvoidingView}>