mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-20 05:12:54 +08:00
fix: login & register
This commit is contained in:
parent
028824cb3e
commit
344ac42008
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user