UNPKG

contentful-utility-suite

Version:
27 lines (26 loc) 709 B
import { CONTENTFUL_API_URL } from "./constants.js"; const getAllEnvironments = async (space) => { try { const res = await fetch(CONTENTFUL_API_URL + `/spaces/${space.spaceID}/environments`, { method: "GET", headers: { "Content-Type": "application/json", Authorization: `Bearer ${space.managementToken}`, }, }); const json = await res.json(); return { error: false, res: json, }; } catch (err) { return { error: true, errorMessage: err.message, }; } }; export const ContentfulManagementAPI = { getAllEnvironments, };