Update template endpoints
This commit is contained in:
parent
610133551e
commit
f93f27877f
|
@ -1,13 +1,20 @@
|
||||||
import { FetchTemplateResponse, Template } from "@budibase/types"
|
import {
|
||||||
|
FetchGlobalTemplateByTypeResponse,
|
||||||
|
FetchGlobalTemplateDefinitionResponse,
|
||||||
|
FetchTemplateResponse,
|
||||||
|
SaveGlobalTemplateRequest,
|
||||||
|
SaveGlobalTemplateResponse,
|
||||||
|
Template,
|
||||||
|
} from "@budibase/types"
|
||||||
import { BaseAPIClient } from "./types"
|
import { BaseAPIClient } from "./types"
|
||||||
|
|
||||||
export interface TemplateEndpoints {
|
export interface TemplateEndpoints {
|
||||||
getEmailTemplates: () => Promise<Template[]>
|
getEmailTemplates: () => Promise<FetchGlobalTemplateByTypeResponse>
|
||||||
getAppTemplates: () => Promise<FetchTemplateResponse>
|
getAppTemplates: () => Promise<FetchTemplateResponse>
|
||||||
|
getEmailTemplateDefinitions: () => Promise<FetchGlobalTemplateDefinitionResponse>
|
||||||
// Missing request or response types
|
saveEmailTemplate: (
|
||||||
getEmailTemplateDefinitions: () => Promise<any>
|
template: SaveGlobalTemplateRequest
|
||||||
saveEmailTemplate: (templaet: any) => Promise<any>
|
) => Promise<SaveGlobalTemplateResponse>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildTemplateEndpoints = (
|
export const buildTemplateEndpoints = (
|
||||||
|
@ -24,10 +31,9 @@ export const buildTemplateEndpoints = (
|
||||||
* Gets the list of email templates.
|
* Gets the list of email templates.
|
||||||
*/
|
*/
|
||||||
getEmailTemplates: async () => {
|
getEmailTemplates: async () => {
|
||||||
const res = await API.get<Template | Template[]>({
|
return await API.get({
|
||||||
url: "/api/global/template/email",
|
url: "/api/global/template/email",
|
||||||
})
|
})
|
||||||
return Array.isArray(res) ? res : [res]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue