HEX
Server: LiteSpeed
System: Linux server318.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: sahadove (2893)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/sahadove/wp-content/plugins/extendify/src/Agent/workflows/content/tools/get-post-status.js
import apiFetch from '@wordpress/api-fetch';

const postTypes = { page: 'pages', post: 'posts' };

// status should only be either "publish" or "draft"
export default async ({ postId, postType }) => {
	const type = postTypes[postType] || postType;
	const response = await apiFetch({
		path: `/wp/v2/${type}/${postId}?context=view`,
	});

	return { post_status: response.status };
};