summaryrefslogtreecommitdiffstats
path: root/src/app/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/index.tsx')
-rw-r--r--src/app/index.tsx54
1 files changed, 21 insertions, 33 deletions
diff --git a/src/app/index.tsx b/src/app/index.tsx
index cf5f7c1..eacde3c 100644
--- a/src/app/index.tsx
+++ b/src/app/index.tsx
@@ -1,39 +1,27 @@
-import { router } from "expo-router";
-import { Button, Text, View } from "react-native";
-import { SafeAreaView } from "react-native-safe-area-context";
+import { Redirect } from 'expo-router';
+import { ActivityIndicator, View } from 'react-native';
+import { useAuthSession } from '@/providers/AuthProvider';
-export default function Index() {
+export default function IndexPage() {
+ const { user, loading } = useAuthSession();
-
- function navegarGuardarPersona(){
- console.log("ir a pantalla")
- router.push({
- pathname: "/GuardarPersona",
- //params:
- })
+ if (loading) {
+ return (
+ <View
+ style={{
+ flex: 1,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}
+ >
+ <ActivityIndicator size="large" />
+ </View>
+ );
}
+ if (user) {
+ return <Redirect href="/(protected)/home" />;
+ }
- function navegarGuardarProducto(){
- console.log("ir a pantalla")
- router.push({
- pathname: "/GuardarProducto",
- //params:
- })
- }
- return (
- <SafeAreaView
- style={{
- flex: 1,
- justifyContent: "center",
- alignItems: "center",
- }}
- >
-
- <Button title="crear usuario " testID="btn-crear-usuario" color={"green"} onPress={()=> navegarGuardarPersona()} />
- {/*
- <Button title="crear categorias y productos " testID="btn-crear-categoria-producto" color={"blue"} onPress={()=> navegarGuardarProducto()} />
- */}
- </SafeAreaView>
- );
+ return <Redirect href="/(auth)/welcome" />;
}