diff --git a/src/app/[spaceId]/fetch.ts b/src/app/[spaceId]/fetch.ts index 665a0e4c1..35c12c725 100644 --- a/src/app/[spaceId]/fetch.ts +++ b/src/app/[spaceId]/fetch.ts @@ -1,4 +1,4 @@ -import { getSpace, getCurrentRevision } from '@/lib/api'; +import { getSpace, getCurrentRevision, getSpaceCustomization } from '@/lib/api'; import { resolvePagePath, resolvePageId } from '@/lib/pages'; @@ -20,7 +20,13 @@ export interface PageIdParams extends SpaceParams { export async function fetchPageData(params: PagePathParams | PageIdParams) { const { spaceId } = params; - const [space, revision] = await Promise.all([getSpace(spaceId), getCurrentRevision(spaceId)]); + const [space, revision, customization] = await Promise.all([ + getSpace(spaceId), + getCurrentRevision(spaceId), + getSpaceCustomization(spaceId), + ]); + + console.log(customization); const page = 'pageId' in params && params.pageId @@ -30,6 +36,7 @@ export async function fetchPageData(params: PagePathParams | PageIdParams) { return { space, revision, + customization, ancestors: [], ...page, }; diff --git a/src/lib/api.ts b/src/lib/api.ts index f9a79c93f..031594324 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -61,3 +61,23 @@ export const getPageDocument = unstable_cache( tags: ['api', 'documents'], }, ); + +/** + * Get the customization settings for a space. + */ +export const getSpaceCustomization = unstable_cache( + async (spaceId: string) => { + // TODO: use function from API client once updated + const { data } = await api().request({ + method: 'GET', + path: `/spaces/${spaceId}/publishing/customization`, + secure: true, + format: 'json', + }); + return data; + }, + ['api', 'customization'], + { + tags: ['api', 'customization'], + }, +);