shlink-web-client/src/short-urls/reducers/shortUrlsListParams.js
2018-08-12 09:22:18 +02:00

18 lines
518 B
JavaScript

import { LIST_SHORT_URLS } from './shortUrlsList';
export const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS';
const defaultState = { page: '1' };
export default function reducer(state = defaultState, action) {
switch (action.type) {
case LIST_SHORT_URLS:
return { ...state, ...action.params };
case RESET_SHORT_URL_PARAMS:
return defaultState;
default:
return state;
}
}
export const resetShortUrlParams = () => ({ type: RESET_SHORT_URL_PARAMS });