res.json type fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user