import Prismic from 'prismic-javascript';
export const apiEndpoint = process.env.PRISMIC_ENDPOINT || null;
// Client method to query documents from the Prismic repo
export const Client = (req = null) => Prismic.client(apiEndpoint, createClientOptions(req, null));
const createClientOptions = (req = null, prismicAccessToken = null) => {
    const reqOption = req ? { req } : {};
    const accessTokenOption = prismicAccessToken ? { accessToken: prismicAccessToken } : {};
    return Object.assign(Object.assign({}, reqOption), accessTokenOption);
};
