const Model: ModelType = {
namespace: 'namesps',
state: {
data: {}
},
effects: {
*fetch({ payload, callback }, { call, put, select }) {
const res = yield call(queryApplyInvoiceInfo, payload);
if (!res || !res.data) return;
const total = yield select((state) => state.user.currentUser )
console.log(total);
yield put({
type: 'change',
payload: res
})
if (callback) callback();
}
},
reducers: {
change (state, { payload }) {
return {
data: (state && state.data) || {
list: [],
pagination: {}
}
}
}
}
};
export default Model;
// 选择 state + '全局属性名(namespace)' + state属性名
const total = yield select((state) => state.user.currentUser )
console.log(total);