Automattic / isolated-block-editor

Repackages Gutenberg's editor playground as a full-featured multi-instance editor that does not require WordPress.
344 stars 50 forks source link

Is there a exposed property to change the root url and paths? #174

Closed adrianhm13 closed 2 years ago

adrianhm13 commented 2 years ago

Hi folks,

I've been trying to change the root URL from the fetch handler where some of the blocks makes requests to get data. I'd like to change this "root" and endpoints for a custom ones but the only thing I could find it's the function setFetchHandler() from the module api-fetch. That function as the name points, it's to change the entire function and I can't find a way to modify these values.

adrianhm13 commented 2 years ago

For the URL I think I've found it.

import apiFetch from "@wordpress/api-fetch";

apiFetch.use(apiFetch.createRootURLMiddleware("https://example.com"));

the paths from some the blocks still a mystery to me, and not sure if it can be changed :/