Skip to content

Commit

Permalink
Fix TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aptkingston committed Dec 5, 2024
1 parent 5c08b6d commit e44ce7e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/frontend-core/src/api/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const buildAnalyticsEndpoints = (
...request,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
},
parseResponse: () => null,
parseResponse: () => undefined,
})
},
})
6 changes: 3 additions & 3 deletions packages/frontend-core/src/api/flags.ts
Original file line number Diff line number Diff line change
@@ -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<Flags>

// Missing request or response types
updateFlag: (flag: string, value: any) => Promise<{ message: string }>
updateFlag: (flag: string, value: any) => Promise<SetUserFlagResponse>
toggleUiFeature: (value: string) => Promise<{ message: string }>
}

Expand All @@ -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<SetFlagRequest, { message: string }>({
return await API.post<SetUserFlagRequest, SetUserFlagResponse>({
url: "/api/users/flags",
body: {
flag,
Expand Down
4 changes: 1 addition & 3 deletions packages/frontend-core/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-core/src/api/licensing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const buildLicensingEndpoints = (
refreshLicense: async () => {
return API.post({
url: "/api/global/license/refresh",
parseResponse: () => null,
parseResponse: () => undefined,
})
},
/**
Expand Down

0 comments on commit e44ce7e

Please sign in to comment.