export default {
namespace: 'tdCall',
state: {
mToken: null,
device: null,
},
effects: {
*getDeviceCall({ payload }, { select, call, put }) {
const { mToken } = yield select(_ => _.tdCall);// 获取state中某个值
const response = yield call(getDeviceCall, payload, mToken);
if (response) {
const { result } = response;
if (result) {
yield put({
type: 'setDeviceCall',
payload: result,
});
}
}
},
},
reducers: {
setDeviceCall(state, action) {
return {
...state,
device: action.payload,
};
},
setMToken(state, action) {
return {
...state,
mToken: action.payload,
};
},
},
};