From 344ac4200877098147ab6e77187c32f57b116008 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Wed, 2 Aug 2023 21:10:46 +0300 Subject: [PATCH] fix: login & register --- src/pages/sign-in.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pages/sign-in.tsx b/src/pages/sign-in.tsx index cd0ad59..b8bc3fb 100644 --- a/src/pages/sign-in.tsx +++ b/src/pages/sign-in.tsx @@ -72,22 +72,27 @@ export function AuthenticationForm(props: PaperProps) { .finally(() => setLoading(false)); } else { supabase.auth - .signInWithPassword({ + .signUp({ email: form.values.email, password: form.values.password, + options: { + data: { name: form.values.name }, + }, }) - .then(({ data, error }) => { + .then(({ error }) => { if (error) return toast.error(error.message); - toast.success("Registration successful!"); + toast.success("Please check your inbox to confirm mail address!", { duration: 7000 }); setDone(true); - setSession(data.session); }) .finally(() => setLoading(false)); } }; const handleLoginClick = (provider: "github" | "google") => { - supabase.auth.signInWithOAuth({ provider }); + supabase.auth.signInWithOAuth({ + provider, + options: { redirectTo: "https://jsoncrack.com/editor" }, + }); }; if (done) {