Skip to content

Commit

Permalink
Try fetching /gutenberg/available-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Feb 26, 2020
1 parent 99fb15a commit a310bc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/api-fetch-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const fetchHandler = ( { path }, retries = 20, retryCount = 1 ) => {
};

export const isPathSupported = ( path ) =>
[ /wp\/v2\/media\/?\d*?.*/i ].some( ( pattern ) => pattern.test( path ) );
[
/wp\/v2\/media\/?\d*?.*/i,
/wpcom\/gutenberg\/.*/i,
].some( ( pattern ) => pattern.test( path ) );

export default () => {
apiFetch.setFetchHandler( ( options ) => fetchHandler( options ) );
Expand Down
7 changes: 6 additions & 1 deletion src/jetpack-editor-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ const setInitialState = async ( {
} ) => {
let availableBlocks = {};
if ( isJetpackActive ) {
availableBlocks = supportedJetpackBlocks; //await apiFetch( { path: `/wp/v2/gutenberg/available-extensions` } );
console.log( 'Fetching /wpcom/v2/gutenberg/available-extensions' );
try {
availableBlocks = await apiFetch( { path: `/wpcom/v2/gutenberg/available-extensions` } );
} catch ( error ) {
console.error( 'Error while fetching available extensions', error );
}
}
const jetpackEditorInitialState = {
available_blocks: availableBlocks,
Expand Down

0 comments on commit a310bc4

Please sign in to comment.