@gdwc/drupal-state
Version:
A simple data store to manage application state sourced from Drupal's JSON:API.
8 lines (5 loc) • 425 B
JavaScript
import f from 'isomorphic-fetch';
var m=(r,o={},t)=>f(r,o),s=m;var c=(r,o={},t=n=>{throw n},p,a=s)=>a(r,o,p).then(e=>{if(!e.ok)throw new Error(`Failed to fetch JSON:API endpoint.
Tried fetching: ${r}
Server responded with status code: ${e.status}`);return e.json()}).then(e=>e).catch(e=>{t(e);}),i=c;var d=async(r,o,t={},p=!1,a=s,n=e=>{throw e})=>await i(r+"?path="+o+"&_format=json",t,n,p,a),A=d;
export { A as default };