import { Reducer, Effect, Subscription } from 'umi';
interface ModelType {
namespace: 'somename';
state: {};
reducers: {
someReducerFn: Reducer;
};
effects: {
effectFn: Effect;
};
subscriptions: {
setup: Subscription;
};
}
const someModel: ModelType = {
namespace: 'somename',
state: {},
reducers: {
someReducerFn(state, action) {
},
},
effects: {
*effectFn(action, effects) {
},
},
subscriptions: {
setup({ dispatch, history }) {
return history.listen(location => {
if (location.pathname === 'someurl') {
dispatch({
type: 'someReducerFn',
});
}
});
},
},
};
export default someModel;