diff --git a/src/redux/user/actions.tsx b/src/redux/user/actions.tsx index a9e458b49586ff521a9f7064b7ab07112668656c..34d015d47821bdd08596c19874f3cac195c211d3 100644 --- a/src/redux/user/actions.tsx +++ b/src/redux/user/actions.tsx @@ -73,24 +73,19 @@ export const signupUser = ( businessType: string ) => { return async (dispatch: Dispatch) => { - try { - const userAuth = await authService.signUpAuth(email, password); - const uid = userAuth.user.uid; - await userService.createUser(uid, { - firstName, - lastName, - email, - phone, - businessType, - pic: "", - }); - return dispatch({ - type: "SIGNUP", - payload: { email, firstName, lastName, id: uid, phone, businessType }, - }); - } catch (e) { - console.log(e); - return { error: e }; - } + const userAuth = await authService.signUpAuth(email, password); + const uid = userAuth.user.uid; + await userService.createUser(uid, { + firstName, + lastName, + email, + phone, + businessType, + pic: "", + }); + return dispatch({ + type: "SIGNUP", + payload: { email, firstName, lastName, id: uid, phone, businessType }, + }); }; }; diff --git a/src/screens/auth/RegisterScreen.tsx b/src/screens/auth/RegisterScreen.tsx index 48ead26fdf1b43df8310cefb20a6f8bf42058a39..fd2b1b4206cb36cb0301095f3e8c2a526376a55a 100644 --- a/src/screens/auth/RegisterScreen.tsx +++ b/src/screens/auth/RegisterScreen.tsx @@ -41,10 +41,12 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { validateEmpty(password) && validateEmpty(picked) ) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call + // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access dispatch( signupUser(firstName, lastName, email, password, phoneNo, picked) - ).then(() => Alert.alert("Error", "Something went wrong")); + ) + .then(() => null) + .catch(() => Alert.alert("Error", "Something went wrong")); // .then((e: ActionErrorRes) => e.error && Alert.alert("Error", e.error)); } else { Alert.alert("Form Tidak Lengkap", "Silahkan isi form dengan benar");