diff --git a/client/package.json b/client/package.json index 7f9b315..91a8b7d 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@taros-minesweeper/client", - "version": "1.0.0", + "version": "1.0.1", "description": "", "main": "dist/index.js", "scripts": { diff --git a/client/src/ApiClient.ts b/client/src/ApiClient.ts index 542d354..f074106 100644 --- a/client/src/ApiClient.ts +++ b/client/src/ApiClient.ts @@ -42,7 +42,8 @@ export const ApiClient = ({ url, accessToken }: ApiClientConfig): ApiClient => { ...contentTypeJsonHeaders, }, }) - if (response.headers.get('Content-Type')?.startsWith('application/json')) + const contentType = response.headers.get('Content-Type') + if (contentType && contentType.startsWith('application/json')) return response.json() else return response.text()