shlink-web-client/src/short-urls/reducers/shortUrlsListParams.js

19 lines
518 B
JavaScript
Raw Normal View History

2018-07-29 20:25:22 +03:00
import { LIST_SHORT_URLS } from './shortUrlsList';
2018-08-12 10:22:18 +03:00
export const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS';
2018-08-04 09:23:44 +03:00
2018-08-05 09:13:12 +03:00
const defaultState = { page: '1' };
2018-08-04 09:23:44 +03:00
export default function reducer(state = defaultState, action) {
switch (action.type) {
case LIST_SHORT_URLS:
return { ...state, ...action.params };
2018-08-04 09:23:44 +03:00
case RESET_SHORT_URL_PARAMS:
return defaultState;
default:
return state;
}
}
2018-08-04 09:23:44 +03:00
export const resetShortUrlParams = () => ({ type: RESET_SHORT_URL_PARAMS });