import { queryCurrent } from './service'; import { Dispatch } from 'redux'; import { CurrentUser } from './data'; export interface ModalState { currentUser: CurrentUser; } type callType = (thisArg?: T, ...args: A) => R; Function.call; export default { namespace: 'BLOCK_NAME_CAMEL_CASE', state: { currentUser: {}, }, effects: { *fetchCurrent( _: ModalState, { call, put, }: { call: callType>; put: Dispatch; } ) { const response = yield call(queryCurrent); yield put({ type: 'saveCurrentUser', payload: response, }); }, }, reducers: { saveCurrentUser( state: ModalState, action: { payload: CurrentUser; } ) { return { ...state, currentUser: action.payload || {}, }; }, }, };