Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
}