[QUESTIONS] Trouble using urlLoad
Question
I've got an issue calling to my endpoint to load a template, it's doing a pre flight OPTIONS request but I cant find how to continue after the OK response
componentDidMount() {
this.editor = GrapesJS.init({
container: '#grapeEditor',
plugins: [gjsPresetNewsletter],
storageManager: {
id: 'gjs-',
type: 'remote',
urlLoad: 'http://localhost:9999/templateEndpoint',
urlStore: 'http://localhost:9999/templateEndpoint',
contentTypeJson: true
}
});
}
componentDidUpdate() {
this.editor.load(e => console.log(e))
}
This is my express server
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
if (req.method == 'OPTIONS' || req.path.indexOf('favicon.ico') >= 0) {
console.log('options method... lets pass...');
res.sendStatus(200);
}
else {
next();
}
});
Answers (3)
Is there more to you server? Does next() actually reach a handler? Can you get the expected template from outside of 🍇 (with curl or postman)?
Try to check errors in console, probably you miss something in your CORS configuration. Try to start only with res.header('Access-Control-Allow-Origin', '*');
BTW I close this as it's not related to grapesjs itself
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1985
[BUG] Autosave with remote storage doesn't send network requests
OS: Windows 10 Browser: Chrome 73 GrapesJS version: 0.14.57 I have remote storage configured using this call to grapesjs.init(): While I se...
Issue #384
Create and Edit Template into Database
This is my code to Create a new template and insert the inline html with style into the database : I am able to insert the template-data in...
Issue #873
[Need help]: After using urlLoad from storage manager impossible to change component with Traits
Hello, I am save template to db and after loading from db impossible to change component with Traits. Video example on countdown: https://y...
Issue #1700
Grapesjs-react
how to load an html file while starting the GrapesJs-react- editor I tried in this way but it is not working, editor.StorageManager.add('lo...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.