problem description
mock data has no problem with taking objects and adding array [0] to report an error 0 is not defined
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
import { getAdpage } from "../services/adpage";
export default {
namespace: "adpage",
state: {
userMessage: {},
amMessage:{},
list:{}
},
reducers: {
save(state, { payload: { userMessage,amMessage,list }}) {
return { ...state, userMessage ,amMessage,list};
},
// saveList(state, { payload: { list, groupList }}) {
// return { ...state, list, groupList };
// },
},
effects: {
*getadpage(_, { call, put }) {
const adpage = yield call(getAdpage)
const { userMessage , amMessage,list } = adpage
yield put({ type: "save", payload: {userMessage,amMessage,list} });
},
},
//
subscriptions:{
setup({dispatch,history}){
return history.listen(({pathname,userMessage,amMessage,list})=>{
if(pathname === "/AD/ADpage"){
dispatch({type:"getone",payload: {userMessage,amMessage,list}})
}
})
}
}
}