UNPKG

gatsby-source-tilda

Version:

Gatsby source plugin for building websites using the tilda.cc CMS as a data source

27 lines (26 loc) 828 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchPageInfo = exports.fetchPages = void 0; const fetchPages = async ({ pluginConfig, reporter, }) => { try { const { projectId } = pluginConfig; const pages = await pluginConfig.api.fetchProjectPages(projectId); return pages; } catch (e) { reporter.panicOnBuild(`Fetch Tilda Pages failed`, e); return []; } }; exports.fetchPages = fetchPages; const fetchPageInfo = async ({ pageId, pluginConfig, reporter, }) => { try { const pageInfo = await pluginConfig.api.fetchPage(pageId); return pageInfo; } catch (e) { reporter.panicOnBuild(`Couldn't get Tilda Page (id: ${pageId}) Info`, e); throw e; } }; exports.fetchPageInfo = fetchPageInfo;