Customize Preview Decision
The default behavior checks whether the storefront is accessed through the ContentCreator. For some scenarios where a high level of security is important, this may not be sufficient.
Therefore, the Frontend API Server package provides a functionality to customize the process of determining whether preview or release state should be fetched like. The following code shows an example of how to do so.
Scope
This code part is meant to be executed on server instances and therefore uses the Frontend API Server.
import { PreviewDecider, PreviewDeciderTemplate } from 'fcecom-frontend-api-server';
class MyCustomPreviewDecider implements PreviewDeciderTemplate {
async isPreview(): Promise<boolean> {
return Promise.resolve(false);
}
}
PreviewDecider.registerDecider(new MyCustomPreviewDecider());
PreviewDecider.useDefaultDecider();
Last update:
February 26, 2024