diff --git a/packages/frontend-core/src/api/analytics.ts b/packages/frontend-core/src/api/analytics.ts index 82a41ca98f..de0de802e1 100644 --- a/packages/frontend-core/src/api/analytics.ts +++ b/packages/frontend-core/src/api/analytics.ts @@ -30,7 +30,7 @@ export const buildAnalyticsEndpoints = ( ...request, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, }, - parseResponse: () => null, + parseResponse: () => undefined, }) }, }) diff --git a/packages/frontend-core/src/api/flags.ts b/packages/frontend-core/src/api/flags.ts index 3a82ed3497..55632182e9 100644 --- a/packages/frontend-core/src/api/flags.ts +++ b/packages/frontend-core/src/api/flags.ts @@ -1,11 +1,11 @@ -import { Flags, SetFlagRequest } from "@budibase/types" +import { Flags, SetUserFlagRequest, SetUserFlagResponse } from "@budibase/types" import { BaseAPIClient } from "./types" export interface FlagEndpoints { getFlags: () => Promise // Missing request or response types - updateFlag: (flag: string, value: any) => Promise<{ message: string }> + updateFlag: (flag: string, value: any) => Promise toggleUiFeature: (value: string) => Promise<{ message: string }> } @@ -25,7 +25,7 @@ export const buildFlagEndpoints = (API: BaseAPIClient): FlagEndpoints => ({ * @param value the value to set the flag to */ updateFlag: async (flag, value) => { - return await API.post({ + return await API.post({ url: "/api/users/flags", body: { flag, diff --git a/packages/frontend-core/src/api/index.ts b/packages/frontend-core/src/api/index.ts index be36f3c485..23d8576e5b 100644 --- a/packages/frontend-core/src/api/index.ts +++ b/packages/frontend-core/src/api/index.ts @@ -160,10 +160,8 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => { try { if (parseResponse) { return await parseResponse(response) - } else if (response.status !== 204) { - return (await response.json()) as ResponseT } else { - return undefined + return (await response.json()) as ResponseT } } catch (error) { delete cache[url] diff --git a/packages/frontend-core/src/api/licensing.ts b/packages/frontend-core/src/api/licensing.ts index f51dced809..fd8ee36e83 100644 --- a/packages/frontend-core/src/api/licensing.ts +++ b/packages/frontend-core/src/api/licensing.ts @@ -84,7 +84,7 @@ export const buildLicensingEndpoints = ( refreshLicense: async () => { return API.post({ url: "/api/global/license/refresh", - parseResponse: () => null, + parseResponse: () => undefined, }) }, /**