update login error message

This commit is contained in:
Fran Jurmanović
2025-08-27 21:33:28 +02:00
parent 9ce5802dc6
commit 55e0370004
5 changed files with 51 additions and 10 deletions

View File

@@ -15,7 +15,11 @@ export async function loginUser(username: string, password: string) {
});
if (!response.ok) {
throw new Error(`Login failed: ${response.statusText} - ${BASE_URL}${authRoute}/login`);
if (response.status === 401) {
throw new Error(`Invalid credentials`);
}
throw new Error(`Login failed: ${response.statusText}`);
}
const { token } = await response.json();