How to use the @sanity/client.requester function in @sanity/client

To help you get started, we’ve selected a few @sanity/client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / @sanity / cli / src / util / clientWrapper.js View on Github external
export default function clientWrapper(manifest, configPath) {
  const requester = client.requester.clone()
  requester.use(authErrors())

  return function(opts = {}) {
    const {requireUser, requireProject, api} = {...defaults, ...opts}
    const userConfig = getUserConfig()
    const userApiConf = userConfig.get('api')
    const token = envAuthToken || userConfig.get('authToken')
    const apiHost = apiHosts[sanityEnv]
    const apiConfig = Object.assign(
      {},
      userApiConf || {},
      (manifest && manifest.api) || {},
      api || {}
    )

    if (apiHost) {

@sanity/client

Client for retrieving, creating and patching data from Sanity.io

MIT
Latest version published 3 days ago

Package Health Score

89 / 100
Full package analysis