How to use the @sanity/util/lib/safeJson.parseJson function in @sanity/util

To help you get started, we’ve selected a few @sanity/util 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 / actions / login / login.js View on Github external
es.addEventListener('failure', msg => {
      es.close()
      const data = parseJson(msg.data, {})
      const error = new Error(data.message)
      Object.keys(data).forEach(key => {
        error[key] = data[key]
      })
      reject(error)
    })
  })
github sanity-io / sanity / packages / @sanity / cli / src / actions / login / login.js View on Github external
es.addEventListener('message', msg => {
      const data = parseJson(msg.data, {})
      if (!wantedProps.includes(data.type)) {
        return
      }

      values[data.type] = data[data.type]
      if (++numProps === wantedProps.length) {
        resolve(values)
      }
    })
  })
github sanity-io / sanity / packages / @sanity / cli / src / actions / login / login.js View on Github external
es.addEventListener('success', msg => {
      es.close()
      const data = parseJson(msg.data, {})
      resolve(data.token)
    })