mirror of
https://github.com/urosran/cally.git
synced 2025-07-10 07:07:16 +00:00
16 lines
632 B
TypeScript
16 lines
632 B
TypeScript
import {useMutation} from "react-query";
|
|
import auth from "@react-native-firebase/auth";
|
|
import {useUpdateUserData} from "@/hooks/firebase/useUpdateUserData";
|
|
import {ProfileType} from "@/contexts/AuthContext";
|
|
|
|
export const useSignUp = () => {
|
|
const { mutateAsync: updateUserData } = useUpdateUserData()
|
|
|
|
return useMutation({
|
|
mutationKey: ["signUp"],
|
|
mutationFn: async ({email, password}: { email: string, password: string }) => {
|
|
await auth().createUserWithEmailAndPassword(email, password);
|
|
await updateUserData({userType: ProfileType.PARENT, email, password});
|
|
}
|
|
});
|
|
} |