Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SelwynAng committed Oct 19, 2024
1 parent e806e89 commit d5b092f
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions frontend/components/auth/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,37 @@ export function LoginForm() {
description: "Login Failed.",
});
}
} catch (err: any) {
let description_text = "";
switch (err.message) {
case "Email and/or password is missing.":
description_text = "Please provide both email and password.";
break;
case "Invalid email or password.":
description_text = "Username or password is incorrect.";
break;
case "Internal server error. Please try again later.":
description_text = "There was an issue with the server. Please try again later.";
break;
default:
description_text = "An unexpected error occurred. Please try again.";
break;
} catch (err: unknown) {
if (err instanceof Error) {
let description_text = "";
switch (err.message) {
case "Email and/or password is missing.":
description_text = "Please provide both email and password.";
break;
case "Invalid email or password.":
description_text = "Username or password is incorrect.";
break;
case "Internal server error. Please try again later.":
description_text =
"There was an issue with the server. Please try again later.";
break;
default:
description_text =
"An unexpected error occurred. Please try again.";
break;
}
toast({
title: "Error",
variant: "destructive",
description: description_text,
});
} else {
toast({
title: "Error",
variant: "destructive",
description: "An unexpected error occurred. Please try again.",
});
}
toast({
title: "Error",
variant: "destructive",
description: description_text,
});
}
};

Expand Down

0 comments on commit d5b092f

Please sign in to comment.