mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-01 21:26:46 +00:00
Moved logic to parse API errors to a helper function
This commit is contained in:
@@ -2,6 +2,7 @@ import { flatten, prop, range, splitEvery } from 'ramda';
|
||||
import { Action, Dispatch } from 'redux';
|
||||
import { ShlinkPaginator, ShlinkVisits } from '../../utils/services/types';
|
||||
import { Visit, VisitsLoadFailedAction } from '../types';
|
||||
import { parseApiError } from '../../api/util';
|
||||
|
||||
const ITEMS_PER_PAGE = 5000;
|
||||
const PARALLEL_REQUESTS_COUNT = 4;
|
||||
@@ -71,6 +72,6 @@ export const getVisitsWithLoader = async <T extends Action<string> & { visits: V
|
||||
|
||||
dispatch({ ...extraFinishActionData, visits, type: actionMap.finish });
|
||||
} catch (e) {
|
||||
dispatch<VisitsLoadFailedAction>({ type: actionMap.error, errorData: e.response?.data });
|
||||
dispatch<VisitsLoadFailedAction>({ type: actionMap.error, errorData: parseApiError(e) });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user