diff --git a/src/utils.ts b/src/utils.ts index d6ece4caac5b4eab34e533afa7a50e275e60a688..9f0d7f05b5006de9abec69f5d5a6edab86df0874 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -28,16 +28,11 @@ export const authedFetchResponse = async ( let response = await fetch(CHAT_SERVER_URL + url, init) - if (response.ok) { - try { - const json = await response.json() - return { status: response.status, json } - } catch { - console.error(`Failed to parse Matrix response: ${JSON.stringify(response)}`) - return { status: response.status, json: {} } - } - } else { - console.error(`Matrix request failed with status ${response.status}: ${JSON.stringify(response)}`) + try { + const json = await response.json() + return { status: response.status, json } + } catch { + console.error(`Failed to parse Matrix response: ${JSON.stringify(response)}`) return { status: response.status, json: {} } } }