Skip to content

Commit fe221cb

Browse files
committed
check for error messages when logging in to olecard/checkbalance
1 parent dfc041a commit fe221cb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source/lib/financials/balances.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ async function fetchBalancesFromServer(): Promise<BalancesOrErrorType> {
6060
username: username,
6161
password: password,
6262
})
63-
await fetch(OLECARD_AUTH_URL, {method: 'POST', body: form})
63+
let loginResponse = await fetch(OLECARD_AUTH_URL, {method: 'POST', body: form})
64+
65+
if (loginResponse.url.includes('message=')) {
66+
return {error: true, value: new Error('login failed!')}
67+
}
6468

6569
const resp: OleCardBalancesType = await fetchJson(OLECARD_DATA_ENDPOINT)
6670

0 commit comments

Comments
 (0)