diff --git a/frontend/src/API/API.ts b/frontend/src/API/API.ts index cf3d1eb..614e714 100644 --- a/frontend/src/API/API.ts +++ b/frontend/src/API/API.ts @@ -639,7 +639,11 @@ export const api: API = { }); if (!response.ok) { - return { success: false, message: "Failed to login" }; + return { + success: false, + data: `${response.status}`, + message: "Failed to login", + }; } else { const data = (await response.json()) as { token: string }; // Update the type of 'data' return { success: true, data: data.token }; diff --git a/frontend/src/Components/LoginCheck.tsx b/frontend/src/Components/LoginCheck.tsx index 752c2dc..50ffb98 100644 --- a/frontend/src/Components/LoginCheck.tsx +++ b/frontend/src/Components/LoginCheck.tsx @@ -46,8 +46,15 @@ function LoginCheck(props: { console.error("Token was undefined"); } } else { - console.error("Token could not be fetched/No such user"); - alert("Could not login, wrong username or password"); + if (response.data === "500") { + console.error(response.message); + alert("No connection/Error"); + } else { + console.error( + "Token could not be fetched/No such user" + response.message, + ); + alert("Incorrect login information"); + } } }) .catch((error) => {