From 989f8de4cad58a7d6f40985e2182719272da30ef Mon Sep 17 00:00:00 2001 From: !MAD! <61308761+iMADi-ARCH@users.noreply.github.com> Date: Mon, 29 May 2023 04:16:15 +0530 Subject: [PATCH] Fix/issue 184 (#185) * fix(auth): use redirect instead of router * fix(auth): use router for after render redirects --- frontend/app/(auth)/login/page.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/app/(auth)/login/page.tsx b/frontend/app/(auth)/login/page.tsx index 0c3992d49aee..24982c193387 100644 --- a/frontend/app/(auth)/login/page.tsx +++ b/frontend/app/(auth)/login/page.tsx @@ -7,7 +7,7 @@ import PageHeading from "@/app/components/ui/PageHeading"; import { useSupabase } from "@/app/supabase-provider"; import { useToast } from "@/lib/hooks/useToast"; import Link from "next/link"; -import { useRouter } from "next/navigation"; +import { redirect } from "next/navigation"; import { useState } from "react"; import { GoogleLoginButton } from "./components/GoogleLogin"; import { MagicLinkLogin } from "./components/MagicLinkLogin"; @@ -20,8 +20,6 @@ export default function Login() { const { publish } = useToast(); - const router = useRouter(); - const handleLogin = async () => { setIsPending(true); const { data, error } = await supabase.auth.signInWithPassword({ @@ -44,7 +42,7 @@ export default function Login() { }; if (session?.user !== undefined) { - router.replace("/"); + redirect("/"); } return (