Fix TS errors
This commit is contained in:
parent
5c08b6d962
commit
e44ce7ee62
|
@ -30,7 +30,7 @@ export const buildAnalyticsEndpoints = (
|
|||
...request,
|
||||
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
},
|
||||
parseResponse: () => null,
|
||||
parseResponse: () => undefined,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -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 }>
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -84,7 +84,7 @@ export const buildLicensingEndpoints = (
|
|||
refreshLicense: async () => {
|
||||
return API.post({
|
||||
url: "/api/global/license/refresh",
|
||||
parseResponse: () => null,
|
||||
parseResponse: () => undefined,
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue