Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async patch (model, body, headers = {}) {
try {
const serialData = serialise.apply(this, [ model, body, 'PATCH' ])
const url = this.plural(this.resCase(model)) + '/' + body.id
const { data } = await this.axios.patch(
url,
serialData,
{ headers: Object.assign(this.headers, headers) }
)
return data
} catch (E) {
throw error(E)
}
}
async delete (model, id, headers = {}) {
try {
const url = this.plural(this.resCase(model)) + '/' + id
const { data } = await this.axios.delete(url, {
data: serialise.apply(this, [ model, { id }, 'DELETE' ]),
headers: Object.assign(this.headers, headers)
})
return data
} catch (E) {
throw error(E)
}
}
async post (model, body, headers = {}) {
try {
const url = this.plural(this.resCase(model))
const { data } = await this.axios.post(
url,
serialise.apply(this, [ model, body ]),
{ headers: Object.assign(this.headers, headers) }
)
return data
} catch (E) {
throw error(E)
}
}