Use header consts from shared-core

This commit is contained in:
Adria Navarro 2023-12-12 12:06:55 +01:00
parent f3e046ba98
commit 005dd27663
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import { Helpers } from "@budibase/bbui" import { Helpers } from "@budibase/bbui"
import { Header } from "@budibase/shared-core"
import { ApiVersion } from "../constants" import { ApiVersion } from "../constants"
import { buildAnalyticsEndpoints } from "./analytics" import { buildAnalyticsEndpoints } from "./analytics"
import { buildAppEndpoints } from "./app" import { buildAppEndpoints } from "./app"
@ -133,9 +134,9 @@ export const createAPIClient = config => {
// Build headers // Build headers
let headers = { Accept: "application/json" } let headers = { Accept: "application/json" }
headers["x-budibase-session-id"] = APISessionID headers[Header.SESSION_ID] = APISessionID
if (!external) { if (!external) {
headers["x-budibase-api-version"] = ApiVersion headers[Header.API_VER] = ApiVersion
} }
if (json) { if (json) {
headers["Content-Type"] = "application/json" headers["Content-Type"] = "application/json"
@ -242,7 +243,7 @@ export const createAPIClient = config => {
getAppID: () => { getAppID: () => {
let headers = {} let headers = {}
config?.attachHeaders(headers) config?.attachHeaders(headers)
return headers?.["x-budibase-app-id"] return headers?.[Header.APP_ID]
}, },
} }