Skip to content

Commit d5b092f

Browse files
committed
Fix linting errors
1 parent e806e89 commit d5b092f

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

frontend/components/auth/login-form.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,37 @@ export function LoginForm() {
4141
description: "Login Failed.",
4242
});
4343
}
44-
} catch (err: any) {
45-
let description_text = "";
46-
switch (err.message) {
47-
case "Email and/or password is missing.":
48-
description_text = "Please provide both email and password.";
49-
break;
50-
case "Invalid email or password.":
51-
description_text = "Username or password is incorrect.";
52-
break;
53-
case "Internal server error. Please try again later.":
54-
description_text = "There was an issue with the server. Please try again later.";
55-
break;
56-
default:
57-
description_text = "An unexpected error occurred. Please try again.";
58-
break;
44+
} catch (err: unknown) {
45+
if (err instanceof Error) {
46+
let description_text = "";
47+
switch (err.message) {
48+
case "Email and/or password is missing.":
49+
description_text = "Please provide both email and password.";
50+
break;
51+
case "Invalid email or password.":
52+
description_text = "Username or password is incorrect.";
53+
break;
54+
case "Internal server error. Please try again later.":
55+
description_text =
56+
"There was an issue with the server. Please try again later.";
57+
break;
58+
default:
59+
description_text =
60+
"An unexpected error occurred. Please try again.";
61+
break;
62+
}
63+
toast({
64+
title: "Error",
65+
variant: "destructive",
66+
description: description_text,
67+
});
68+
} else {
69+
toast({
70+
title: "Error",
71+
variant: "destructive",
72+
description: "An unexpected error occurred. Please try again.",
73+
});
5974
}
60-
toast({
61-
title: "Error",
62-
variant: "destructive",
63-
description: description_text,
64-
});
6575
}
6676
};
6777

0 commit comments

Comments
 (0)