@muban/storybook
Version:
Storybook for Muban: View and Test Muban components.
30 lines (29 loc) • 1.29 kB
JavaScript
import {} from '@storybook/types';
import {} from '../../types.js';
export function validateServerConfig(options) {
var _a, _b, _c;
if (!((_a = options.storyContext.parameters['server']) === null || _a === void 0 ? void 0 : _a.url)) {
options.showError({
title: `Server url is not configured`,
description: `You've chosen server rendering, but "parameters.server.url" is not configured.`,
});
return false;
}
if (!((_b = options.storyContext.parameters['server']) === null || _b === void 0 ? void 0 : _b.id)) {
options.showError({
title: `Server story id is not configured`,
description: `You've chosen server rendering, but "parameters.server.id" is not configured for your story,
which means the server doesn't know which template to render.`,
});
return false;
}
if ((_c = options.storyContext.parameters['server']) === null || _c === void 0 ? void 0 : _c.disabled) {
options.showError({
title: `Server rendering is disabled`,
description: `You've chosen server rendering, but "parameters.server.disabled" is set to disallow
server rendering (for this component/story).`,
});
return false;
}
return true;
}