The clientProvider
abstraction has gotten a makeover to simplify the API. Instead of exposting graphqlClient
and restClient
functions, it now has a namespace that contains both online
and offline
objects. Each object contains a graphqlClient
and restClient
function that can be used to create a client for the respective access mode.
import clientProvider from "@/utils/clientProvider";
const { client, shop, session } = await clientProvider.online.graphqlClient({
req,
res,
});
const { client, shop, session } = await clientProvider.online.restClient({
req,
res,
});
import clientProvider from "@/utils/clientProvider";
const { client, shop, session } = await clientProvider.offline.graphqlClient({
shop: req.user_shop,
});
const { client, shop, session } = await clientProvider.offline.restClient({
shop: req.user_shop,
});
- Head into
verifyRequest
and add inreq.user_shop = session.shop
afterreq.user_session = session;
. - Update your
graphqlClient
andrestClient
calls toclientProvider.online.graphqlClient
/clientProvider.offline.graphqlClient
andclientProvider.online.restClient
/clientProvider.offline.restClient