Currently restructuring Vuex, and facing a common action:
deleteFromList ({commit}, {list = '', type = '', listPlural = '', data = {}}) {
db.rel.find(list, data).then(doc => {
return db.rel.del(list, doc.rooms[0])
})
}
When list
is set to room
, it returns doc.rooms
, an object containing rooms.
In this scenario, the listPlural
parameter would have the value of rooms
.
How can I dynamically return doc.rooms[0]
using the listPlural
parameter instead?
Is there a way to achieve something like doc.listPlural[0]
? Just looking for ideas.