payload-plugin-scheduler
Version:
Scheduled posts plugin for PayloadCMS
28 lines (27 loc) • 961 B
JavaScript
import React from 'react';
import { getScheduledPublishJobsWhere } from "../../../../lib.js";
import AfterInputClient from "./client.js";
const AfterInputServer = async ({ value, siblingData, payload, collectionSlug, data, path })=>{
const isGlobal = data?.globalType !== undefined;
const scheduleWhere = isGlobal ? {
type: 'global',
slug: data.globalType
} : {
type: 'collection',
id: siblingData?.id,
slug: collectionSlug
};
const scheduledJobs = await payload.find({
collection: 'payload-jobs',
where: getScheduledPublishJobsWhere(scheduleWhere)
});
const scheduledJob = scheduledJobs.docs[0];
return /*#__PURE__*/ React.createElement(AfterInputClient, {
scheduledAt: scheduledJob?.waitUntil,
path: path,
currentFormValue: value,
status: siblingData?._status
});
};
export default AfterInputServer;
//# sourceMappingURL=server.js.map