Fakultas Ilmu Komputer UI

Commit c2bfaff4 authored by Ahmad Izzudin Alifyandra's avatar Ahmad Izzudin Alifyandra
Browse files

fix: register transition bug

parent 9bc7b5f2
Pipeline #86287 passed with stage
in 9 minutes and 45 seconds
...@@ -73,24 +73,19 @@ export const signupUser = ( ...@@ -73,24 +73,19 @@ export const signupUser = (
businessType: string businessType: string
) => { ) => {
return async (dispatch: Dispatch<any>) => { return async (dispatch: Dispatch<any>) => {
try { const userAuth = await authService.signUpAuth(email, password);
const userAuth = await authService.signUpAuth(email, password); const uid = userAuth.user.uid;
const uid = userAuth.user.uid; await userService.createUser(uid, {
await userService.createUser(uid, { firstName,
firstName, lastName,
lastName, email,
email, phone,
phone, businessType,
businessType, pic: "",
pic: "", });
}); return dispatch({
return dispatch({ type: "SIGNUP",
type: "SIGNUP", payload: { email, firstName, lastName, id: uid, phone, businessType },
payload: { email, firstName, lastName, id: uid, phone, businessType }, });
});
} catch (e) {
console.log(e);
return { error: e };
}
}; };
}; };
...@@ -41,10 +41,12 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => { ...@@ -41,10 +41,12 @@ const RegisterScreen = ({ navigation }: RootTabScreenProps<"TabOne">) => {
validateEmpty(password) && validateEmpty(password) &&
validateEmpty(picked) 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( dispatch(
signupUser(firstName, lastName, email, password, phoneNo, picked) 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)); // .then((e: ActionErrorRes) => e.error && Alert.alert("Error", e.error));
} else { } else {
Alert.alert("Form Tidak Lengkap", "Silahkan isi form dengan benar"); Alert.alert("Form Tidak Lengkap", "Silahkan isi form dengan benar");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment