Fix profile type

This commit is contained in:
Milan Paunovic
2024-08-21 20:30:07 +02:00
parent 6b42476ef0
commit 55a3091023
4 changed files with 24 additions and 19 deletions

View File

@ -5,7 +5,11 @@ import {useRouter} from "expo-router";
import firestore from "@react-native-firebase/firestore";
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
export enum ProfileType { "parent", "child", "caregiver" }
export enum ProfileType {
"PARENT" = "parent",
"CHILD" = "child",
"CAREGIVER" = "caregiver"
}
interface IAuthContext {
user: FirebaseAuthTypes.User | null,
@ -37,7 +41,7 @@ export const AuthContextProvider: FC<{ children: ReactNode }> = ({children}) =>
.doc(user.uid)
.get();
if (documentSnapshot.exists) {
setProfileType(documentSnapshot.data()?.profileType);
setProfileType(documentSnapshot.data()?.userType);
setProfileData(documentSnapshot.data() as UserProfile)
}