Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: sign-in redirect

AykutSaraca18a8885af83
diff --git a/src/pages/reset-password.tsx b/src/pages/reset-password.tsx
index ac06293d..5c812eec 100644
--- a/src/pages/reset-password.tsx
+++ b/src/pages/reset-password.tsx
@@ -1,9 +1,7 @@
import React from "react";
import Head from "next/head";
import Link from "next/link";
-import { useRouter } from "next/router";
import { PaperProps, Button, Group, Paper, Stack, TextInput, Text, Anchor } from "@mantine/core";
-import { useSession } from "@supabase/auth-helpers-react";
import { toast } from "react-hot-toast";
import { Footer } from "src/layout/Footer";
import { JSONCrackLogo } from "src/layout/JsonCrackLogo";
@@ -19,7 +17,7 @@ export function AuthenticationForm(props: PaperProps) {
e.preventDefault();
setLoading(true);
supabase.auth
- .resetPasswordForEmail(email, { redirectTo: "/reset-password" })
+ .resetPasswordForEmail(email)
.then(({ error }) => {
if (error) return toast.error(error.message);
setSuccess(true);
@@ -65,14 +63,7 @@ export function AuthenticationForm(props: PaperProps) {
);
}
-const SignIn = () => {
- const { isReady, push } = useRouter();
- const session = useSession();
-
- React.useEffect(() => {
- if (session) push("/editor");
- }, [isReady, session, push]);
-
+const ResetPassword = () => {
return (
<div>
<Head>
@@ -89,4 +80,4 @@ const SignIn = () => {
);
};
-export default SignIn;
+export default ResetPassword;
diff --git a/src/pages/sign-in.tsx b/src/pages/sign-in.tsx
index 5e0cf94a..44389e2b 100644
--- a/src/pages/sign-in.tsx
+++ b/src/pages/sign-in.tsx
@@ -281,8 +281,8 @@ const SignIn = () => {
const [alertVisible, setAlertVisible] = React.useState(true);
React.useEffect(() => {
- if (session) push("/editor");
- }, [isReady, session, push]);
+ if (session && !isPasswordReset) push("/editor");
+ }, [isReady, session, push, isPasswordReset]);
return (
<div>