diff --git a/app/Provider.tsx b/app/Provider.tsx index 9d4ac84..1df1b9f 100644 --- a/app/Provider.tsx +++ b/app/Provider.tsx @@ -9,7 +9,7 @@ interface Props { session?: Session; } -export default async function Provider({ children }: Props) { +export default function Provider({ children }: Props) { return ( { const { data: session } = useSession(); const router = useRouter(); + const handleSignIn = async (provider: string) => { + try { + await signIn(provider); + // Redirect to home page after sign-in + router.push("/"); + toast.success("Logged in successfully"); + } catch (error) { + toast.error("Sign in failed"); + console.error("Sign in error:", error); + } + }; + useEffect(() => { if (session) { - toast.success("Logged in successfully"); router.push(`/`); + toast.success("Logged in successfully"); } - }, [session]); + }, [session, router]); return ( <>
@@ -33,7 +45,7 @@ const Page = () => {