Issue #2191Opened August 14, 2019by andyjoneski2 reactions

[Question] - UrlLoad and UrlSave

Question

hi,

Grapesjs is a fantastic bit of software and I've been playing with it for a week or so now. Im struggling a little with the urlLoad.

storageManager: {
    autosave: true,
    setStepsBeforeSave: 2,
    type: 'remote',
    urlStore: '/rest/V1/aware/save/:page_id', 
    urlLoad: '/rest/V1/aware/getJson/:page_id',
    contentTypeJson: true,
    headers: { Authorization: 'Bearer TOKEN' }
}

Im using an end point which is returning json as you can see here:

Screenshot 2019-08-14 at 08 14 15

How I've read the documentation, is this supposed to load the layout into the canvas?

What I'm trying to do, is use the endpoints to save the canvas - and load the canvas etc. But on load nothing happens, I'm left with a blank canvas. Really appreciate if you could point me in the right direction, or a demo etc.

thanks

Answers (1)

artfAugust 14, 20192 reactions

The result of your endpoint is totally wrong. Read carefully this part please: https://grapesjs.com/docs/modules/Storage.html#setup-the-server You should return something like this:

{
  // `gjs-` is the id prefix
  'gjs-components': [{ tagName: 'div', ... }, {...}, ...],
  'gjs-style': [{...}, {...}, ...],
}

Now, you're returning only components:

[{ tagName: 'div', ... }, {...}, ...]

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.