Wocart

@wocart/storefront v3.1.0


@wocart/storefront / server / readPreviewRequest

Function: readPreviewRequest()

readPreviewRequest(request, options): Promise<PreviewRequest>

Read a preview request. Two kinds, both refused — and nothing rendered — unless the token verifies for this storefront and theme:

  • GET ?token=…&surface=…[&locale=…][&path=…]: the editor frames the preview. The draft names what to show and carries nothing else, so the page renders as saved until the editor sends a draft.
  • POST JSON { token, draft } from this storefront's own origin: the framed page re-rendering a draft. A cross-site form can never post one.

Parameters

request

Request

options

PreviewRequestOptions

Returns

Promise<PreviewRequest>