Update layout endpoints

This commit is contained in:
Andrew Kingston 2024-12-05 15:34:43 +00:00
parent 2b06a7d44e
commit 4c80d9e970
No known key found for this signature in database
1 changed files with 8 additions and 4 deletions

View File

@ -1,9 +1,13 @@
import { Layout, SaveLayoutRequest, SaveLayoutResponse } from "@budibase/types" import {
DeleteLayoutResponse,
SaveLayoutRequest,
SaveLayoutResponse,
} from "@budibase/types"
import { BaseAPIClient } from "./types" import { BaseAPIClient } from "./types"
export interface LayoutEndpoints { export interface LayoutEndpoints {
saveLayout: (layout: Layout) => Promise<SaveLayoutResponse> saveLayout: (layout: SaveLayoutRequest) => Promise<SaveLayoutResponse>
deleteLayout: (id: string, rev: string) => Promise<{ message: string }> deleteLayout: (id: string, rev: string) => Promise<DeleteLayoutResponse>
} }
export const buildLayoutEndpoints = (API: BaseAPIClient): LayoutEndpoints => ({ export const buildLayoutEndpoints = (API: BaseAPIClient): LayoutEndpoints => ({
@ -12,7 +16,7 @@ export const buildLayoutEndpoints = (API: BaseAPIClient): LayoutEndpoints => ({
* @param layout the layout to save * @param layout the layout to save
*/ */
saveLayout: async layout => { saveLayout: async layout => {
return await API.post<SaveLayoutRequest, SaveLayoutResponse>({ return await API.post({
url: "/api/layouts", url: "/api/layouts",
body: layout, body: layout,
}) })