Skip to content

Commit 046b51a

Browse files
committed
refactor(kitsu): (internal) pass camel and plural options as arguments to serialise
1 parent 34b9cae commit 046b51a

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

packages/kitsu/src/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ export default class Kitsu {
218218
*/
219219
async patch (model, body, headers = {}) {
220220
try {
221-
const serialData = serialise.apply(this, [ model, body, 'PATCH' ])
221+
const serialData = serialise(model, body, 'PATCH', {
222+
camelCaseTypes: this.camel,
223+
pluralTypes: this.plural
224+
})
222225
const url = this.plural(this.resCase(model)) + '/' + body.id
223226
const { data } = await this.axios.patch(
224227
url,
@@ -258,7 +261,10 @@ export default class Kitsu {
258261
const url = this.plural(this.resCase(model))
259262
const { data } = await this.axios.post(
260263
url,
261-
serialise.apply(this, [ model, body ]),
264+
serialise(model, body, 'POST', {
265+
camelCaseTypes: this.camel,
266+
pluralTypes: this.plural
267+
}),
262268
{ headers: Object.assign(this.headers, headers) }
263269
)
264270

@@ -283,7 +289,10 @@ export default class Kitsu {
283289
try {
284290
const url = this.plural(this.resCase(model)) + '/' + id
285291
const { data } = await this.axios.delete(url, {
286-
data: serialise.apply(this, [ model, { id }, 'DELETE' ]),
292+
data: serialise(model, { id }, 'DELETE', {
293+
camelCaseTypes: this.camel,
294+
pluralTypes: this.plural
295+
}),
287296
headers: Object.assign(this.headers, headers)
288297
})
289298

0 commit comments

Comments
 (0)