2024-01-18 18:27:38 +08:00
|
|
|
import { Effect, Reducer, Subscription } from 'umi';
|
2024-01-17 09:37:01 +08:00
|
|
|
|
2024-01-18 18:27:38 +08:00
|
|
|
export interface chatModelState {
|
2024-01-17 09:37:01 +08:00
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 18:27:38 +08:00
|
|
|
export interface chatModelType {
|
|
|
|
|
namespace: 'chatModel';
|
|
|
|
|
state: chatModelState;
|
2024-01-17 09:37:01 +08:00
|
|
|
effects: {
|
|
|
|
|
query: Effect;
|
|
|
|
|
};
|
|
|
|
|
reducers: {
|
2024-01-18 18:27:38 +08:00
|
|
|
save: Reducer<chatModelState>;
|
2024-01-17 09:37:01 +08:00
|
|
|
};
|
|
|
|
|
subscriptions: { setup: Subscription };
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 18:27:38 +08:00
|
|
|
const Model: chatModelType = {
|
|
|
|
|
namespace: 'chatModel',
|
2024-01-17 09:37:01 +08:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-18 18:27:38 +08:00
|
|
|
export default Model;
|