Add search params to publish action

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-03-30 17:33:01 +02:00
parent 4cb5524a14
commit 848215148a

View File

@ -211,7 +211,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
const onPublish = useCallback(async () => { const onPublish = useCallback(async () => {
try { try {
emitEventRef.current('willPublishEntry'); emitEventRef.current('willPublishEntry');
const endPoint = getRequestUrl(`${slug}/actions/publish`); const endPoint = getRequestUrl(`${slug}/actions/publish${searchToSend}`);
dispatch(setStatus('publish-pending')); dispatch(setStatus('publish-pending'));
@ -231,7 +231,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
dispatch(setStatus('resolved')); dispatch(setStatus('resolved'));
} }
}, [cleanReceivedData, displayErrors, slug, dispatch]); }, [cleanReceivedData, displayErrors, slug, searchToSend, dispatch]);
const onPut = useCallback( const onPut = useCallback(
async (body, trackerProperty) => { async (body, trackerProperty) => {
@ -267,7 +267,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
// The publish and unpublish method could be refactored but let's leave the duplication for now // The publish and unpublish method could be refactored but let's leave the duplication for now
const onUnpublish = useCallback(async () => { const onUnpublish = useCallback(async () => {
const endPoint = getRequestUrl(`${slug}/actions/unpublish`); const endPoint = getRequestUrl(`${slug}/actions/unpublish${searchToSend}`);
dispatch(setStatus('unpublish-pending')); dispatch(setStatus('unpublish-pending'));
@ -286,7 +286,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
dispatch(setStatus('resolved')); dispatch(setStatus('resolved'));
displayErrors(err); displayErrors(err);
} }
}, [cleanReceivedData, displayErrors, slug, dispatch]); }, [cleanReceivedData, displayErrors, slug, dispatch, searchToSend]);
return children({ return children({
componentsDataStructure, componentsDataStructure,