Skip to content

Commit 9ae1e5f

Browse files
committed
handle normal and envelope mode
1 parent 3e6e053 commit 9ae1e5f

File tree

1 file changed

+5
-2
lines changed
  • projects/packages/videopress/src/client/block-editor/hooks/use-video-data

1 file changed

+5
-2
lines changed

projects/packages/videopress/src/client/block-editor/hooks/use-video-data/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,14 @@ export default function useVideoData( {
100100
// Check if the video belongs to the current site.
101101
try {
102102
const doesBelong: { body: boolean } = await apiFetch( {
103-
path: `/wpcom/v2/videopress/${ guid }/check-ownership/${ response.post_id }?_envelope`,
103+
path: `/wpcom/v2/videopress/${ guid }/check-ownership/${ response.post_id }`,
104104
method: 'GET',
105105
} );
106106

107-
setVideoBelongToSite( !! doesBelong?.body );
107+
// Response shape can change depending on the envelope mode.
108+
setVideoBelongToSite(
109+
typeof doesBelong === 'boolean' ? doesBelong : !! doesBelong?.body
110+
);
108111
} catch ( error ) {
109112
debug( 'Error checking if video belongs to site', error );
110113
}

0 commit comments

Comments
 (0)