I'm trying to incorporate the async/await syntax into my Redux actions but, for some reason, it's not working. I cannot for the life of me see what is wrong with the following:
const actions = {
load: async (staff, date) => dispatch => {
const data = {
dateFrom: date,
dateTo: date,
person: staff,
personType: 'staff'
};
const events = utils.getDataPromise('json/events/load', data);
const classes = utils.getDataPromise('json/timetable/load', data);
dispatch({
type: actions.MYDAY_LOAD,
staff,
date: date || new Date(),
events: await events,
classes: await classes
});
},
}
The utils function definitely returns a promise.