@fetchToState
This decorator register class method as fetchToStateReceiver in eventrix.
import React from 'react';
import { useEventrix, fetchToState } from 'eventrix';
@useEventrix
class ClientsService {
constructor(services) {
this.axios = services.axios;
}
@fetchToState('Clients:loadList', 'clients')
getList(params, state, emit) {
return this.axios.get('http://someDomain.com', { params })
.then(({ data }) => {
return data;
});
};
}
export default ClientsService;Below example of code without decorators
Last updated
Was this helpful?