From 4e57c0ef996fae56f25de1ecabf1d2988a758637 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 27 Jun 2022 09:31:00 +0100 Subject: [PATCH] Remove hardcoded reference to rest namespace. (#41950) --- packages/editor/src/store/actions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/store/actions.js b/packages/editor/src/store/actions.js index f5cba43c8219fc..52981d294c3a56 100644 --- a/packages/editor/src/store/actions.js +++ b/packages/editor/src/store/actions.js @@ -250,10 +250,12 @@ export const trashPost = .resolveSelect( coreStore ) .getPostType( postTypeSlug ); registry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID ); + const { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } = + postType; try { const post = select.getCurrentPost(); await apiFetch( { - path: `/wp/v2/${ postType.rest_base }/${ post.id }`, + path: `/${ restNamespace }/${ restBase }/${ post.id }`, method: 'DELETE', } );