How to use the kitsu-core.deserialise function in kitsu-core

To help you get started, we’ve selected a few kitsu-core 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 wopian / kitsu / packages / kitsu / src / index.js View on Github external
async get (model, params = {}, headers = {}) {
    try {
      const [ res, id, relationship ] = model.split('/')

      let url = this.plural(this.resCase(res))
      if (id) url += `/${id}`
      if (relationship) url += `/${this.resCase(relationship)}`

      /* istanbul ignore next */
      const { data } = await this.axios.get(url, {
        params,
        paramsSerializer: p => query(p),
        headers: Object.assign(this.headers, headers)
      })

      return deserialise(data)
    } catch (E) {
      throw error(E)
    }
  }

kitsu-core

Simple, lightweight & framework agnostic JSON:API (de)serialsation components

MIT
Latest version published 9 months ago

Package Health Score

74 / 100
Full package analysis