Files
mobile-darmasaba/app/index.tsx
amel 56cc74ed19 upd: push notifikasi
Deskripsi:
- blm selesai

No Issues
2025-06-18 17:27:03 +08:00

37 lines
1003 B
TypeScript

import ViewLogin from "@/components/auth/viewLogin";
import ViewVerification from "@/components/auth/viewVerification";
import { useAuthSession } from "@/providers/AuthProvider";
import { Redirect } from "expo-router";
import { useState } from "react";
import { Text } from "react-native";
import { useNotification } from "@/lib/useNotification";
export default function Index() {
useNotification()
const [isValid, setValid] = useState(false)
const [phone, setPhone] = useState('')
const [otp, setOtp] = useState(0)
const { token, isLoading } = useAuthSession()
if (isLoading) {
return <Text>Loading...</Text>;
}
if (token?.current) {
return <Redirect href="/home" />;
}
if (isValid) { return <ViewVerification phone={phone} otp={otp} /> }
return (
<>
<ViewLogin
onValidate={(val) => {
setPhone(val.phone)
setOtp(val.otp)
setValid(true)
}}
/>
</>
);
}