UNPKG

onnet-portal

Version:

Ant Design Pro based test2

47 lines (39 loc) 865 B
import { Effect, Reducer } from 'umi'; import { EffectsCommandMap } from 'dva'; import { aGetAccount } from '../services/kazoo'; export interface KzooCacheModelType { namespace: 'kz_cache'; state: {}; effects: { refreshAccountState: Effect; }; reducers: { update: Reducer<{}>; flush: Reducer<{}>; }; } const KzooCacheModel: KzooCacheModelType = { namespace: 'kz_cache', state: { account_name: [] }, effects: { *refresh({ payload }, { call, put }) { const response = yield call(aGetAccount, payload); yield put({ type: 'update', payload: response, }); }, *flush(_, { put }) { yield put({ type: 'update', payload: {}, }); }, }, reducers: { update(state, { payload }) { return { ...payload }; }, }, }; export default KzooCacheModel;