How can I can change CORS policy for my account

Following up in case others run into this, after re-reading the docs I see that Prismic only supports GET vs POST, which is the standard most libraries use. I’ve been able to get things working with the custom prismic Apollo link.

Here’s the snippet that works:

import { PrismicLink } from “apollo-link-prismic”;
import { InMemoryCache, IntrospectionFragmentMatcher } from “apollo-cache-inmemory”;
import ApolloClient from “apollo-client”;
import gql from “graphql-tag”;

const client = new ApolloClient({
link: PrismicLink({ uri: “https://your-prismic-project.prismic.io/graphql”, }),
cache: new InMemoryCache({
fragmentMatcher: new IntrospectionFragmentMatcher({ introspectionQueryResultData: { __schema: { types: , }, }, })
})
});

async function runQuery(query, variables = null) {
const result = await client.query({query, variables});
if (result) return result.data;
else return null;
}

// call it as:
const QUERY = gql query Pages ($type: String) { _allDocuments (type: $type) { edges { node { _meta { id, uid, type, } } } } };

funQuery(QUERY, {type:“foo”}).then(data => {

});

1 Like