43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
|
|
import {
|
||
|
|
httpGetInterceptor,
|
||
|
|
httpPostInterceptor,
|
||
|
|
} from "./http-config/http-interceptor-services";
|
||
|
|
|
||
|
|
export async function submitCmsContentSubmission(body: {
|
||
|
|
domain: string;
|
||
|
|
title: string;
|
||
|
|
payload: Record<string, unknown>;
|
||
|
|
}) {
|
||
|
|
return httpPostInterceptor("/cms-content-submissions", body);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function listCmsContentSubmissions(params?: {
|
||
|
|
/** Omit or `all` for every status (history). */
|
||
|
|
status?: string;
|
||
|
|
mine?: boolean;
|
||
|
|
page?: number;
|
||
|
|
limit?: number;
|
||
|
|
}) {
|
||
|
|
const q = new URLSearchParams();
|
||
|
|
if (params?.status != null && params.status !== "") {
|
||
|
|
q.set("status", params.status);
|
||
|
|
}
|
||
|
|
if (params?.mine) q.set("mine", "1");
|
||
|
|
if (params?.page) q.set("page", String(params.page));
|
||
|
|
if (params?.limit) q.set("limit", String(params.limit));
|
||
|
|
const qs = q.toString();
|
||
|
|
return httpGetInterceptor(
|
||
|
|
`/cms-content-submissions${qs ? `?${qs}` : ""}`,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function approveCmsContentSubmission(id: string) {
|
||
|
|
return httpPostInterceptor(`/cms-content-submissions/${id}/approve`, {});
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function rejectCmsContentSubmission(id: string, note?: string) {
|
||
|
|
return httpPostInterceptor(`/cms-content-submissions/${id}/reject`, {
|
||
|
|
note: note ?? "",
|
||
|
|
});
|
||
|
|
}
|