Skip to content

Commit 989f8de

Browse files
Fix/issue 184 (#185)
* fix(auth): use redirect instead of router * fix(auth): use router for after render redirects
1 parent b92f5a7 commit 989f8de

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

frontend/app/(auth)/login/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import PageHeading from "@/app/components/ui/PageHeading";
77
import { useSupabase } from "@/app/supabase-provider";
88
import { useToast } from "@/lib/hooks/useToast";
99
import Link from "next/link";
10-
import { useRouter } from "next/navigation";
10+
import { redirect } from "next/navigation";
1111
import { useState } from "react";
1212
import { GoogleLoginButton } from "./components/GoogleLogin";
1313
import { MagicLinkLogin } from "./components/MagicLinkLogin";
@@ -20,8 +20,6 @@ export default function Login() {
2020

2121
const { publish } = useToast();
2222

23-
const router = useRouter();
24-
2523
const handleLogin = async () => {
2624
setIsPending(true);
2725
const { data, error } = await supabase.auth.signInWithPassword({
@@ -44,7 +42,7 @@ export default function Login() {
4442
};
4543

4644
if (session?.user !== undefined) {
47-
router.replace("/");
45+
redirect("/");
4846
}
4947

5048
return (

0 commit comments

Comments
 (0)