From 316703c631c0a76f6a8e597a3aab08e20313b2eb Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Wed, 13 Mar 2024 05:35:23 +0100 Subject: [PATCH] Updated sdk --- src/sdk.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk.ts b/src/sdk.ts index 7ef5add..9b2bf91 100644 --- a/src/sdk.ts +++ b/src/sdk.ts @@ -80,8 +80,8 @@ const injectAuth = async (init?: RequestInit): Promise => ({ const logResponse = (res: Response) => console.log(res.status, res.statusText, res.url); -const payloadApiUrl = (collection: Collections, endpoint?: string): string => - `${process.env.PAYLOAD_API_URL}/${collection}${endpoint === undefined ? "" : `/${endpoint}`}`; +const payloadApiUrl = (collection: Collections, endpoint?: string, isGlobal?: boolean): string => + `${process.env.PAYLOAD_API_URL}/${isGlobal === undefined ? "" : "globals/"}${collection}${endpoint === undefined ? "" : `/${endpoint}`}`; const request = async (url: string, init?: RequestInit): Promise => { const result = await fetch(url, await injectAuth(init)); @@ -329,8 +329,8 @@ export type PayloadImage = { export const payload = { getEras: async (): Promise => await (await request(payloadApiUrl(Collections.ChronologyEras, `all`))).json(), - getRootFolders: async (): Promise => - await (await request(payloadApiUrl(Collections.Folders, `root`))).json(), + getHomeFolders: async (): Promise => + await (await request(payloadApiUrl(Collections.HomeFolders, `all`, true))).json(), getFolder: async (slug: string): Promise => await (await request(payloadApiUrl(Collections.Folders, `slug/${slug}`))).json(), getLanguages: async (): Promise =>