File size: 573 Bytes
362ec6c
6b8fc2c
362ec6c
 
6b8fc2c
 
362ec6c
 
 
 
 
 
 
 
 
 
 
6b8fc2c
362ec6c
 
 
 
 
 
6b8fc2c
362ec6c
 
 
 
6b8fc2c
 
362ec6c
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
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;