From 3a7182bfb5734599321fc03ea77c48b4dbc326d5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 3 Dec 2022 19:42:05 +0900 Subject: Fastify (#9106) * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * Update SignupApiService.ts * wip * wip * Update ClientServerService.ts * wip * wip * wip * Update WellKnownServerService.ts * wip * wip * update des * wip * Update ApiServerService.ts * wip * update deps * Update WellKnownServerService.ts * wip * update deps * Update ApiCallService.ts * Update ApiCallService.ts * Update ApiServerService.ts --- packages/client/src/os.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'packages/client/src/os.ts') diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 515fc47819..7e57dcb4af 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -29,11 +29,14 @@ export const api = ((endpoint: string, data: Record = {}, token?: s if (token !== undefined) (data as any).i = token; // Send request - fetch(endpoint.indexOf('://') > -1 ? endpoint : `${apiUrl}/${endpoint}`, { + window.fetch(endpoint.indexOf('://') > -1 ? endpoint : `${apiUrl}/${endpoint}`, { method: 'POST', body: JSON.stringify(data), credentials: 'omit', cache: 'no-cache', + headers: { + 'Content-Type': 'application/json', + }, }).then(async (res) => { const body = res.status === 204 ? null : await res.json(); @@ -63,7 +66,7 @@ export const apiGet = ((endpoint: string, data: Record = {}) => { const promise = new Promise((resolve, reject) => { // Send request - fetch(`${apiUrl}/${endpoint}?${query}`, { + window.fetch(`${apiUrl}/${endpoint}?${query}`, { method: 'GET', credentials: 'omit', cache: 'default', -- cgit v1.2.3-freya