Defined how to parse visit stats and how to render them

This commit is contained in:
Alejandro Celaya
2018-07-30 20:31:48 +02:00
parent a75c7309f7
commit d97cbdde5d
7 changed files with 196 additions and 13 deletions

View File

@@ -34,11 +34,11 @@ export default function dispatch (state = initialState, action) {
}
}
export const getShortUrlVisits = shortCode => async dispatch => {
export const getShortUrlVisits = (shortCode, dates) => async dispatch => {
dispatch({ type: GET_SHORT_URL_VISITS_START });
try {
const visits = await ShlinkApiClient.getShortUrlVisits(shortCode);
const visits = await ShlinkApiClient.getShortUrlVisits(shortCode, dates);
dispatch({ visits, type: GET_SHORT_URL_VISITS });
} catch (e) {
dispatch({ type: GET_SHORT_URL_VISITS_ERROR });