const fetchTodoListData = () => { return (dispatch, getState) => { dispatch({type: ActionTypes.TODO_LIST_REQUEST_DATA}); return todoApi.get('/todo').then((response) => { dispatch({type: ActionTypes.TODO_LIST_RECEIVE_DATA, todos: response.data, lastUpdated: new Date()}); }).catch((response) => { dispatch({type: ActionTypes.AUTH_RECEIVE_ERROR, response: response}); }); } }
public get({ uri, params }: IGetRequestOption): Promise<HttpResponse> { try { const res = super.get({ uri, params }); if (res !== null) { return Promise.resolve(res); } } catch (e) { return Promise.reject(e) as any; } const result = this._getWithoutInterceptor({ uri, params }); return super.responseGet(uri, result); }
const fetchTodoListData = () => { return (dispatch, getState) => { dispatch({type: ActionTypes.TODO_LIST_REQUEST_DATA}); return todoApi.get('/todo').then((response) => { dispatch({type: ActionTypes.TODO_LIST_RECEIVE_DATA, todos: response.data, lastUpdated: new Date()}); }).catch((response) => { dispatch({type: ActionTypes.AUTH_RECEIVE_ERROR, response: response}); }); } }