I have implemented this async for api service to get payload.
export function loadAsync() {
return async dispatch => {
try {
dispatch({ type: 'LOADING_START' })
const item = await asyncService.query()
const mapItems = item['payload']['items']; // l need help here please
dispatch({ type: 'SET_GRADE', mapItems})
console.log('Actions: err in load',mapItems)
} catch (err) {
console.log('Actions: err in load', err)
} finally {
dispatch({ type: 'LOADING_DONE' })
}
}
}
Expected payload { "code": 200, "payload": { "items": [ { "name": "test test test test test ", "grades": [ { "name": "C" }, { "name": "A" } ] } ] } }