import { authClient } from "@/lib/auth-client"; {{#if (eq api "trpc")}} import { queryClient } from "@/utils/trpc"; {{/if}} {{#if (eq api "orpc")}} import { queryClient } from "@/utils/orpc"; {{/if}} import { useState } from "react"; import { ActivityIndicator, Text, TextInput, TouchableOpacity, View, } from "react-native"; export function SignIn() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const handleLogin = async () => { setIsLoading(true); setError(null); await authClient.signIn.email( { email, password, }, { onError: (error) => { setError(error.error?.message || "Failed to sign in"); setIsLoading(false); }, onSuccess: () => { setEmail(""); setPassword(""); queryClient.refetchQueries(); }, onFinished: () => { setIsLoading(false); }, }, ); }; return ( Sign In {error && ( {error} )} {isLoading ? ( ) : ( Sign In )} ); }