2018-07-29 20:25:22 +03:00
|
|
|
import { LIST_SHORT_URLS } from './shortUrlsList';
|
2018-06-17 18:12:16 +03:00
|
|
|
|
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) {
|
2018-06-17 18:12:16 +03:00
|
|
|
switch (action.type) {
|
2018-07-22 10:37:57 +03:00
|
|
|
case LIST_SHORT_URLS:
|
2018-06-17 18:12:16 +03:00
|
|
|
return { ...state, ...action.params };
|
2018-08-04 09:23:44 +03:00
|
|
|
case RESET_SHORT_URL_PARAMS:
|
|
|
|
return defaultState;
|
2018-06-17 18:12:16 +03:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
2018-08-04 09:23:44 +03:00
|
|
|
|
|
|
|
export const resetShortUrlParams = () => ({ type: RESET_SHORT_URL_PARAMS });
|