Save or cancel preview entity

Last updated on
16 May 2019

To finish, to save or cancel the entity preview you got two choice there :

Redirection

-you can simply redirect on the value give into previewGraphQLUrlCallback when you are in GET methd or send inside "callback_url"  in  case of POST method.

When you redirect on Drupal don't forget to send back the "carrier" :

-Inside authoriztion headers for JWT

-In url parameter with the cache id and carrier key.

 After redirection user will arrived on the entity form.

Then the user can cancel or save his entity (like the preview node workflow)

So for this choice front end needs to implement one button (return to form) with the redirection.

Call graphQL mutation

Before use the mutation you must to enable it into settings. If your graphQL endpoint allowed anonymous user, you must to be sure of your permissions before enable this features (in order that no anonymous can save preview inside your Drupal)

You can use the mutation previewGraphQLCallback with an previewGraphQLInput to save or cancel the preview.  You can set the "operation" parameter of this input to "cancel" if you want to cancel preview, otherwise it wil proceed save. 

When you send mutation on Drupal don't forget to send back the "carrier" :

-Inside authoriztion headers for JWT

-In url parameter with the cache id and carrier key.

So for this choice front end needs to implements two button (cancel and save) and a redirection (or not).

Help improve this page

Page status: No known problems

You can: