mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
Auth logic rework
This commit is contained in:
@ -5,7 +5,7 @@ import {useRouter} from "expo-router";
|
||||
import firestore from "@react-native-firebase/firestore";
|
||||
import {UserProfile} from "@/hooks/firebase/types/profileTypes";
|
||||
|
||||
type ProfileType = "parent" | "child" | "caregiver" | null;
|
||||
export enum ProfileType { "parent", "child", "caregiver" }
|
||||
|
||||
interface IAuthContext {
|
||||
user: FirebaseAuthTypes.User | null,
|
||||
@ -28,6 +28,8 @@ export const AuthContextProvider: FC<{ children: ReactNode }> = ({children}) =>
|
||||
const onAuthStateChanged = async (user: FirebaseAuthTypes.User | null) => {
|
||||
setUser(user);
|
||||
|
||||
console.log(user)
|
||||
|
||||
if (user) {
|
||||
try {
|
||||
const documentSnapshot = await firestore()
|
||||
@ -41,7 +43,7 @@ export const AuthContextProvider: FC<{ children: ReactNode }> = ({children}) =>
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error fetching user profile type:", error);
|
||||
setProfileType(null);
|
||||
setProfileType(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user