File "get-block-content.js"
Full Path: /home/buyiwexj/public_html/wp-content/plugins/extendify/src/Agent/workflows/block-selector/tools/get-block-content.js
File size: 468 bytes
MIME-type: text/x-java
Charset: utf-8
import { useQuickEditStore } from '@quick-edit/state/store';
import apiFetch from '@wordpress/api-fetch';
export default async () => {
const block = useQuickEditStore.getState().agentBlock;
if (!block?.id) return { previousContent: '' };
const { postId } = window.extAgentData.context;
const response = await apiFetch({
path: `/extendify/v1/agent/get-block-code?postId=${postId}&blockId=${block.id}`,
});
return { previousContent: response?.block ?? '' };
};