mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: show error messages from request (#1375)
This commit is contained in:
parent
428d0dbac9
commit
b87e2fff4c
@ -46,14 +46,12 @@ const HomePage: NextPage = () => {
|
|||||||
} else {
|
} else {
|
||||||
throw Error("Cant find credentials");
|
throw Error("Cant find credentials");
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
console.log(error);
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Error signing in!",
|
title: "Error signing in!",
|
||||||
type: "error",
|
type: "error",
|
||||||
message:
|
message:
|
||||||
error?.error ||
|
err?.error || "Something went wrong. Please try again later or contact the support team.",
|
||||||
"Something went wrong. Please try again later or contact the support team.",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -71,13 +69,12 @@ const HomePage: NextPage = () => {
|
|||||||
} else {
|
} else {
|
||||||
throw Error("Cant find credentials");
|
throw Error("Cant find credentials");
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Error signing in!",
|
title: "Error signing in!",
|
||||||
type: "error",
|
type: "error",
|
||||||
message:
|
message:
|
||||||
error?.error ||
|
err?.error || "Something went wrong. Please try again later or contact the support team.",
|
||||||
"Something went wrong. Please try again later or contact the support team.",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -88,22 +85,23 @@ const HomePage: NextPage = () => {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
try {
|
try {
|
||||||
if (response) mutateUser();
|
if (response) mutateUser();
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
console.log(error);
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Error signing in!",
|
|
||||||
type: "error",
|
type: "error",
|
||||||
|
title: "Error!",
|
||||||
message:
|
message:
|
||||||
error?.error ||
|
err?.error ||
|
||||||
"Something went wrong. Please try again later or contact the support team.",
|
"Something went wrong. Please try again later or contact the support team.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch((err) =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Oops!",
|
|
||||||
type: "error",
|
type: "error",
|
||||||
message: "Enter the correct email address and password to sign in",
|
title: "Error!",
|
||||||
|
message:
|
||||||
|
err?.error ||
|
||||||
|
"Something went wrong. Please try again later or contact the support team.",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -111,14 +109,12 @@ const HomePage: NextPage = () => {
|
|||||||
const handleEmailCodeSignIn = async (response: any) => {
|
const handleEmailCodeSignIn = async (response: any) => {
|
||||||
try {
|
try {
|
||||||
if (response) mutateUser();
|
if (response) mutateUser();
|
||||||
} catch (error: any) {
|
} catch (err: any) {
|
||||||
console.log(error);
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
title: "Error signing in!",
|
|
||||||
type: "error",
|
type: "error",
|
||||||
|
title: "Error!",
|
||||||
message:
|
message:
|
||||||
error?.error ||
|
err?.error || "Something went wrong. Please try again later or contact the support team.",
|
||||||
"Something went wrong. Please try again later or contact the support team.",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -63,11 +63,13 @@ const ResetPasswordPage: NextPage = () => {
|
|||||||
});
|
});
|
||||||
router.push("/");
|
router.push("/");
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch((err) =>
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Something went wrong. Please try again.",
|
message:
|
||||||
|
err?.error ||
|
||||||
|
"Something went wrong. Please try again later or contact the support team.",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -47,20 +47,15 @@ const SignUp: NextPage = () => {
|
|||||||
if (response) await mutateUser();
|
if (response) await mutateUser();
|
||||||
router.push("/");
|
router.push("/");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) =>
|
||||||
if (err.status === 400)
|
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "error",
|
type: "error",
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "An user already exists with this Email ID.",
|
message:
|
||||||
});
|
err?.error ||
|
||||||
else
|
"Something went wrong. Please try again later or contact the support team.",
|
||||||
setToastAlert({
|
})
|
||||||
type: "error",
|
);
|
||||||
title: "Error!",
|
|
||||||
message: "Something went wrong. Please try again later or contact the support team.",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -28,7 +28,7 @@ class AuthService extends APIService {
|
|||||||
return response?.data;
|
return response?.data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
throw error?.response;
|
throw error?.response?.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ class AuthService extends APIService {
|
|||||||
throw error?.response?.data;
|
throw error?.response?.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async magicSignIn(data: any) {
|
async magicSignIn(data: any) {
|
||||||
const response = await this.post("/api/magic-sign-in/", data, { headers: {} });
|
const response = await this.post("/api/magic-sign-in/", data, { headers: {} });
|
||||||
if (response?.status === 200) {
|
if (response?.status === 200) {
|
||||||
|
Loading…
Reference in New Issue
Block a user