mirror of
https://github.com/urosran/cally.git
synced 2025-07-17 02:25:10 +00:00
Fix
This commit is contained in:
@ -9,8 +9,8 @@ export const useSignUp = () => {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationKey: ["signUp"],
|
mutationKey: ["signUp"],
|
||||||
mutationFn: async ({email, password}: { email: string, password: string }) => {
|
mutationFn: async ({email, password}: { email: string, password: string }) => {
|
||||||
await auth().createUserWithEmailAndPassword(email, password);
|
const res= await auth().createUserWithEmailAndPassword(email, password);
|
||||||
await updateUserData({userType: ProfileType.PARENT, email, password});
|
await updateUserData({userType: ProfileType.PARENT, email, password, customUser: res.user});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -2,13 +2,16 @@ import {useAuthContext} from "@/contexts/AuthContext";
|
|||||||
import {useMutation} from "react-query";
|
import {useMutation} from "react-query";
|
||||||
import firestore from "@react-native-firebase/firestore";
|
import firestore from "@react-native-firebase/firestore";
|
||||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||||
|
import {FirebaseAuthTypes} from "@react-native-firebase/auth";
|
||||||
|
|
||||||
export const useUpdateUserData = () => {
|
export const useUpdateUserData = () => {
|
||||||
const {user, setProfileData} = useAuthContext()
|
const {user: currentUser, setProfileData} = useAuthContext()
|
||||||
|
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationKey: ["updateUserData"],
|
mutationKey: ["updateUserData"],
|
||||||
mutationFn: async (newProfileData: Partial<UserProfile>) => {
|
mutationFn: async (newProfileData: Partial<UserProfile & { customUser?: FirebaseAuthTypes.User }>) => {
|
||||||
|
const user = currentUser ?? newProfileData.customUser
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
try {
|
try {
|
||||||
console.log("yall don't even");
|
console.log("yall don't even");
|
||||||
|
Reference in New Issue
Block a user