UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

2 lines (1 loc) 388 B
import{useState as s,useEffect as h}from"react";import{getGraphQlSchema as i}from"./services/index.js";import{isPrebuiltSchema as l}from"./schema-input-types.js";function S(e){const a=l(e),[c,t]=s(a?e.graphql:void 0),[o,r]=s(!a);return h(()=>{async function m(){r(!0);const f=await i(e);t(f),r(!1)}a?t(e.graphql):m()},Object.values(e)),{schema:c,loading:o}}export{S as useGraphqlSchema};