| 1 |
import { useQuickEditStore } from '@quick-edit/state/store'; |
| 2 |
import apiFetch from '@wordpress/api-fetch'; |
| 3 |
|
| 4 |
export default async () => { |
| 5 |
const block = useQuickEditStore.getState().agentBlock; |
| 6 |
if (!block?.id) return { previousContent: '' }; |
| 7 |
const { postId } = window.extAgentData.context; |
| 8 |
const response = await apiFetch({ |
| 9 |
path: `/extendify/v1/agent/get-block-code?postId=${postId}&blockId=${block.id}`, |
| 10 |
}); |
| 11 |
return { previousContent: response?.block ?? '' }; |
| 12 |
}; |
| 13 |
|