This commit is contained in:
Milan Paunovic
2024-08-23 18:16:26 +02:00
parent 5863ed7f4d
commit 64ae88a732
3 changed files with 10 additions and 8 deletions

View File

@ -4,13 +4,13 @@ import {useUpdateUserData} from "@/hooks/firebase/useUpdateUserData";
import {ProfileType} from "@/contexts/AuthContext";
export const useSignUp = () => {
const { mutateAsync: updateUserData } = useUpdateUserData()
const {mutateAsync: updateUserData} = useUpdateUserData()
return useMutation({
mutationKey: ["signUp"],
mutationFn: async ({email, password}: { email: string, password: string }) => {
const res= await auth().createUserWithEmailAndPassword(email, password);
await updateUserData({userType: ProfileType.PARENT, email, password, customUser: res.user});
const res = await auth().createUserWithEmailAndPassword(email, password);
await updateUserData({newUserData: {userType: ProfileType.PARENT}, customUser: res.user});
}
});
}