File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ export default ({ strapi }) => ({
1212 try {
1313 const { hooks } = getPluginService ( 'settingsService' ) . get ( ) ;
1414
15- await hooks . beforePublish ( { strapi, uid, entity : publishedEntity } ) ;
15+ // Fetch the entity before publishing
16+ const entity = await strapi . entityService . findOne ( uid , entityId , { locale } ) ;
17+
18+ await hooks . beforePublish ( { strapi, uid, entity } ) ;
1619
1720 const publishedEntity = await strapi . documents ( uid ) . publish ( {
1821 documentId : entityId ,
@@ -36,7 +39,10 @@ export default ({ strapi }) => ({
3639 try {
3740 const { hooks } = getPluginService ( 'settingsService' ) . get ( ) ;
3841
39- await hooks . beforeUnpublish ( { strapi, uid, entity : unpublishedEntity } ) ;
42+ // Fetch the entity before unpublishing
43+ const entity = await strapi . entityService . findOne ( uid , entityId , { locale } ) ;
44+
45+ await hooks . beforeUnpublish ( { strapi, uid, entity } ) ;
4046
4147 const unpublishedEntity = await strapi . documents ( uid ) . unpublish ( {
4248 documentId : entityId ,
You can’t perform that action at this time.
0 commit comments