@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
23 lines (20 loc) • 719 B
JavaScript
;
function storefrontClientFactory({ params, session, }) {
const { api } = params;
return {
graphql: async (query, options = {}) => {
const client = new api.clients.Storefront({
session,
apiVersion: options.apiVersion,
});
const apiResponse = await client.request(query, {
variables: options?.variables,
retries: options?.tries ? options.tries - 1 : 0,
headers: options?.headers,
});
return new Response(JSON.stringify(apiResponse));
},
};
}
exports.storefrontClientFactory = storefrontClientFactory;
//# sourceMappingURL=factory.js.map