Skip to content

Commit

Permalink
Fix/issue 184 (#185)
Browse files Browse the repository at this point in the history
* fix(auth): use redirect instead of router

* fix(auth): use router for after render redirects
  • Loading branch information
adityanandanx authored May 28, 2023
1 parent b92f5a7 commit 989f8de
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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({
Expand All @@ -44,7 +42,7 @@ export default function Login() {
};

if (session?.user !== undefined) {
router.replace("/");
redirect("/");
}

return (
Expand Down

1 comment on commit 989f8de

@vercel
Copy link

@vercel vercel bot commented on 989f8de May 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.