bugfix - verify email

This commit is contained in:
James Wyndham 2024-06-05 15:56:59 +08:00
parent a57af24533
commit bd6ca82bb3
3 changed files with 10 additions and 3 deletions

View File

@ -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 };
} catch (error) {
throw error;
console.log(error)
return JSON.parse(JSON.stringify(error))
}
}

View File

@ -24,12 +24,15 @@ function ModalSignIn() {
const onSubmit = async (data: any) => {
try {
//login user
const auth = (await login({ email: data.email, password: data.password }))
if (
(await login({ email: data.email, password: data.password })).success
auth.success
) {
reset();
document.getElementById("sign-in-modal")?.click();
router.push("/account");
} else {
throw new Error(auth.response.message)
}
} catch (error) {
if (error instanceof Error) {

View File

@ -69,8 +69,9 @@ function ModalSignUp({
.collection("user")
.create({ ...data, organisation: organisation.id });
//login user
const auth = (await login({ email: data.email, password: data.password }))
if (
(await login({ email: data.email, password: data.password })).success
auth.success
) {
reset();
document.getElementById("sign-up-modal")?.click();
@ -82,6 +83,8 @@ function ModalSignUp({
price
? generateCheckoutPage(JSON.parse(price), type ?? "")
: router.push("/account");
} else {
throw new Error(auth.response.message)
}
} catch (error) {
if (error instanceof Error) {