Skip to content

Commit 1bc6248

Browse files
authored
feat(model): handle 'data' wrapped responses for create and update (#109)
Laravel allows data wrapping for all responses, so create and update requests should support this if it is done.
1 parent 279f9dc commit 1bc6248

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Model.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ export default class Model extends StaticModel {
370370
url: this.endpoint(),
371371
data: this
372372
}).then(response => {
373-
return this._applyInstance(response.data)
373+
return this._applyInstance(response.data.data || response.data)
374374
})
375375
}
376376

@@ -380,7 +380,7 @@ export default class Model extends StaticModel {
380380
url: this.endpoint(),
381381
data: this
382382
}).then(response => {
383-
return this._applyInstance(response.data)
383+
return this._applyInstance(response.data.data || response.data)
384384
})
385385
}
386386

0 commit comments

Comments
 (0)