File size: 931 Bytes
fad2ec7 6b8fc2c fad2ec7 6b8fc2c fad2ec7 6b8fc2c fad2ec7 6b8fc2c fad2ec7 6b8fc2c fad2ec7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import { Effect, Reducer, Subscription } from 'umi';
export interface chatModelState {
name: string;
}
export interface chatModelType {
namespace: 'chatModel';
state: chatModelState;
effects: {
query: Effect;
};
reducers: {
save: Reducer<chatModelState>;
};
subscriptions: { setup: Subscription };
}
const Model: chatModelType = {
namespace: 'chatModel',
state: {
name: 'kate',
},
effects: {
*query({ payload }, { call, put }) { },
},
reducers: {
save(state, action) {
return {
...state,
...action.payload,
};
},
},
subscriptions: {
setup({ dispatch, history }) {
return history.listen((query) => {
console.log(query)
});
},
},
};
export default Model; |