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 = (
businessType: string
) => {
return async (dispatch: Dispatch<any>) => {
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 },
});
};
};
......@@ -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");
......
Markdown is supported
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