mirror of
https://github.com/Sosokker/chefhai.git
synced 2025-12-19 05:54:08 +01:00
33 lines
796 B
TypeScript
33 lines
796 B
TypeScript
import { useAuth } from "@/context/auth-context";
|
|
import "@/global.css";
|
|
import { Redirect } from "expo-router";
|
|
import React from "react";
|
|
import { ActivityIndicator, View } from "react-native";
|
|
|
|
export default function Index() {
|
|
const { isAuthenticated, isLoading } = useAuth();
|
|
|
|
// Show loading indicator while checking auth status
|
|
if (isLoading) {
|
|
return (
|
|
<View
|
|
style={{
|
|
flex: 1,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
backgroundColor: "white",
|
|
}}
|
|
>
|
|
<ActivityIndicator size="large" color="#ffd60a" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
// Redirect based on authentication status
|
|
if (isAuthenticated) {
|
|
return <Redirect href="/welcome" />;
|
|
} else {
|
|
return <Redirect href="/welcome" />;
|
|
}
|
|
}
|