balibabu
feat: remove loading from model and use DvaModel instead of redundant types such as kAModelType (#47)
362ec6c
import { DvaModel } from 'umi'; | |
export interface ChatModelState { | |
name: string; | |
} | |
const model: DvaModel<ChatModelState> = { | |
namespace: 'chatModel', | |
state: { | |
name: 'kate', | |
}, | |
reducers: { | |
save(state, action) { | |
return { | |
...state, | |
...action.payload, | |
}; | |
}, | |
}, | |
subscriptions: { | |
setup({ dispatch, history }) { | |
return history.listen((query) => { | |
console.log(query); | |
}); | |
}, | |
}, | |
effects: { | |
*query({ payload }, { call, put }) {}, | |
}, | |
}; | |
export default model; | |