forked from mrwyndham/fastpocket
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 };
|
||||
} catch (error) {
|
||||
throw error;
|
||||
console.log(error)
|
||||
return JSON.parse(JSON.stringify(error))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue