fix: login & register

This commit is contained in:
AykutSarac 2023-08-02 21:10:46 +03:00
parent 028824cb3e
commit 344ac42008
No known key found for this signature in database

View File

@ -72,22 +72,27 @@ export function AuthenticationForm(props: PaperProps) {
.finally(() => setLoading(false)); .finally(() => setLoading(false));
} else { } else {
supabase.auth supabase.auth
.signInWithPassword({ .signUp({
email: form.values.email, email: form.values.email,
password: form.values.password, password: form.values.password,
options: {
data: { name: form.values.name },
},
}) })
.then(({ data, error }) => { .then(({ error }) => {
if (error) return toast.error(error.message); 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); setDone(true);
setSession(data.session);
}) })
.finally(() => setLoading(false)); .finally(() => setLoading(false));
} }
}; };
const handleLoginClick = (provider: "github" | "google") => { const handleLoginClick = (provider: "github" | "google") => {
supabase.auth.signInWithOAuth({ provider }); supabase.auth.signInWithOAuth({
provider,
options: { redirectTo: "https://jsoncrack.com/editor" },
});
}; };
if (done) { if (done) {