TP-27854 | Fix QA testing comments (#330)

* TP-27854 | Fix QA testing comments

* TP-27854  | Fix

Co-authored-by: Aman Sethi <aman.sethi@navi.com>

Co-authored-by: Aman Sethi <aman.sethi@navi.com>
This commit is contained in:
Himanshu Kansal
2023-05-09 19:43:56 +05:30
committed by GitHub Enterprise
parent 76be3a6bec
commit 4f322bde25
3 changed files with 32 additions and 6 deletions

View File

@@ -72,12 +72,16 @@ export const verifyGoogleSignIn = (idToken: string) => async (dispatch: AppDispa
const fcmToken = await AsyncStorage.getItem('fcmtoken');
try {
const response = await axiosInstance.post(url, {
idToken,
fcmToken,
deviceId: GLOBAL.DEVICE_ID,
deviceType: GLOBAL.DEVICE_TYPE,
});
const response = await axiosInstance.post(
url,
{
idToken,
fcmToken,
deviceId: GLOBAL.DEVICE_ID,
deviceType: GLOBAL.DEVICE_TYPE,
},
{ headers: { donotHandleError: true } }
);
if (response?.data?.sessionDetails) {
const { sessionDetails, user } = response.data;
dispatch(
@@ -87,6 +91,10 @@ export const verifyGoogleSignIn = (idToken: string) => async (dispatch: AppDispa
isLoggedIn: true,
})
);
toast({
text1: ToastMessages.LOGIN_SUCCESSFUL,
type: 'success',
});
dispatch(setVerifyOTPSuccess('Login Successfully!'));
dispatch(resetLoginForm());
}

View File

@@ -57,5 +57,7 @@ export const ToastMessages = {
PAYMENT_LINK_NOT_GENERATED: 'Payment link could not be generated',
PAYMENT_LINK_RETRY: 'Please retry after an hour for this number',
GENERIC_ERROR_TOAST: 'Something went wrong',
FETCHING_USER_DATA: 'Fetching user data...',
LOGIN_SUCCESSFUL: 'Login Successful!',
SSO_SERVER_SIGN_IN_ERROR: 'Error while signing in to cosmos',
};

View File

@@ -26,11 +26,17 @@ import { GoogleSignin, User as GoogleSigninUser } from '@react-native-google-sig
import { GenericType } from '../../common/GenericTypes';
import { logError } from '../../components/utlis/errorUtils';
import GoogleIcon from '../../assets/icons/GoogleIcon';
import { toast } from '../../../RN-UI-LIB/src/components/toast';
import { ToastMessages } from '../allCases/constants';
interface ILoginForm {
phoneNumber: string;
}
export enum GoogleSignInError {
SIGN_IN_ACTION_CANCELLED = '12501',
}
GoogleSignin.configure({
webClientId: GOOGLE_SSO_CLIENT_ID,
});
@@ -71,11 +77,21 @@ function Login() {
await GoogleSignin.hasPlayServices();
const userInfo: GoogleSigninUser = await GoogleSignin.signIn();
if (userInfo?.idToken) {
toast({
text1: ToastMessages.FETCHING_USER_DATA,
type: 'success',
});
await dispatch(verifyGoogleSignIn(userInfo.idToken));
return;
}
throw userInfo;
} catch (error: GenericType) {
if (error?.code !== GoogleSignInError.SIGN_IN_ACTION_CANCELLED) {
toast({
text1: ToastMessages.GENERIC_ERROR_TOAST,
type: 'error',
});
}
await handleGoogleLogout();
logError(error);
}