We have a problem--each component using our RemoteData mixin will have different data properties to fetch. Therefore, we need to pass parameters to our mixin. Since a mixin is essentially a definition object, why not use a function that can take parameters and then return a definition object? That's what we will do in our case!
- Wrap the object we have defined inside a function with a resources parameter:
export default function (resources) { return { data () { return { remoteDataLoading: 0, } }, } }
The resources parameter will be an object with each key being the name of the data property we want to add, and the value being the path of the request that needs to be made to the server.
- So we need to change the way ...