bugfix - verify email
This commit is contained in:
parent
a57af24533
commit
bd6ca82bb3
|
@ -134,7 +134,8 @@ export async function login(formData: { email: string; password: string }) {
|
||||||
}
|
}
|
||||||
return { success: true, error: "Failed to log in", token: token, data: data };
|
return { success: true, error: "Failed to log in", token: token, data: data };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
console.log(error)
|
||||||
|
return JSON.parse(JSON.stringify(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,15 @@ function ModalSignIn() {
|
||||||
const onSubmit = async (data: any) => {
|
const onSubmit = async (data: any) => {
|
||||||
try {
|
try {
|
||||||
//login user
|
//login user
|
||||||
|
const auth = (await login({ email: data.email, password: data.password }))
|
||||||
if (
|
if (
|
||||||
(await login({ email: data.email, password: data.password })).success
|
auth.success
|
||||||
) {
|
) {
|
||||||
reset();
|
reset();
|
||||||
document.getElementById("sign-in-modal")?.click();
|
document.getElementById("sign-in-modal")?.click();
|
||||||
router.push("/account");
|
router.push("/account");
|
||||||
|
} else {
|
||||||
|
throw new Error(auth.response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|
|
@ -69,8 +69,9 @@ function ModalSignUp({
|
||||||
.collection("user")
|
.collection("user")
|
||||||
.create({ ...data, organisation: organisation.id });
|
.create({ ...data, organisation: organisation.id });
|
||||||
//login user
|
//login user
|
||||||
|
const auth = (await login({ email: data.email, password: data.password }))
|
||||||
if (
|
if (
|
||||||
(await login({ email: data.email, password: data.password })).success
|
auth.success
|
||||||
) {
|
) {
|
||||||
reset();
|
reset();
|
||||||
document.getElementById("sign-up-modal")?.click();
|
document.getElementById("sign-up-modal")?.click();
|
||||||
|
@ -82,6 +83,8 @@ function ModalSignUp({
|
||||||
price
|
price
|
||||||
? generateCheckoutPage(JSON.parse(price), type ?? "")
|
? generateCheckoutPage(JSON.parse(price), type ?? "")
|
||||||
: router.push("/account");
|
: router.push("/account");
|
||||||
|
} else {
|
||||||
|
throw new Error(auth.response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
|
|
Loading…
Reference in New Issue