UNPKG

@paroicms/server

Version:
15 lines 662 B
import { getHandleOfFeaturedImage } from "../../common/media-handles.helpers.js"; export async function getFeaturedImageOf(renderingContext, { nodeId, documentType, }) { if (documentType && !documentType.withFeaturedImage) return; const { siteContext, withAttachedData } = renderingContext; const handle = getHandleOfFeaturedImage(nodeId); const media = await siteContext.mediaStorage.getMedia({ handle, withAttachedData }); if (!media) return; if (media.kind !== "image") { throw new Error(`media '${media.id}' should be an image (${handle})`); } return media; } //# sourceMappingURL=medias.helpers.js.map