type caught error to any

This commit is contained in:
m5r
2021-08-28 02:05:44 +08:00
parent 8765d2b7e5
commit 43f89216ae
12 changed files with 13 additions and 13 deletions

View File

@ -24,7 +24,7 @@ export const LoginForm = (props: LoginFormProps) => {
try {
await loginMutation(values);
props.onSuccess?.();
} catch (error) {
} catch (error: any) {
if (error instanceof AuthenticationError) {
return { [FORM_ERROR]: "Sorry, those credentials are invalid" };
} else {

View File

@ -24,7 +24,7 @@ export const SignupForm = (props: SignupFormProps) => {
try {
await signupMutation(values);
props.onSuccess?.();
} catch (error) {
} catch (error: any) {
if (error.code === "P2002" && error.meta?.target?.includes("email")) {
// This error comes from Prisma
return { email: "This email is already being used" };