res.json type fixes

This commit is contained in:
Cadence Ember
2025-12-01 16:03:27 +13:00
parent 6d0a98eb49
commit 20453aab43
3 changed files with 4 additions and 6 deletions

View File

@@ -22,6 +22,7 @@ async function fetchMessage(messageID) {
throw new Error(`Failed to connect to PK API: ${networkError.toString()}`)
}
if (!res.ok) throw new Error(`PK API returned an error: ${await res.text()}`)
/** @type {any} */
const root = await res.json()
if (!root.member) throw new Error(`PK API didn't return member data: ${JSON.stringify(root)}`)
return root

View File

@@ -72,6 +72,7 @@ async function mreq(method, url, bodyIn, extra = {}) {
}, extra)
const res = await fetch(baseUrl + url, opts)
/** @type {any} */
const root = await res.json()
if (!res.ok || root.errcode) {