Skip to content

Commit

Permalink
fix: weird structure corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed Nov 28, 2024
1 parent dd29464 commit 6b8fc04
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ async function execute<TResult, TVariables>(
)
}

return response.json() as TResult
const responseObject = await response.json()

if (!response || !responseObject.data) {
console.log(responseObject)
throw new Error(
'WTClientRequestError: Malformed JSON data'
)
}

return responseObject.data as TResult
}

export default class WTClient {
Expand Down

0 comments on commit 6b8fc04

Please sign in to comment.