Open
Description
Let's take this model as example:
export default class Transfer extends Model {
static entity = 'transfers'
static fields () {
return {
id: this.attr(null),
files: this.hasMany(File, 'transfer_id'),
links: this.hasMany(Link, 'transfer_id'),
}
}
Currently we receive the entities all separated. But it would be nice if the requested model would also had the objects included (like if you would execute query().withAll())
return Transfer.api().get(`/transfers/${transferId}`)
.then((response) => {
console.log(response.entities.transfers)
console.log(response.entities.files)
console.log(response.entities.links)
// Have to query to this way to get files
let transfer = Transfer.query()
.withAll()
.where({
id: response.entities.transfers[0]
})
.first();
commit('doSomething', transfer)
})