Removed shortUrlsListParams reducer, as the state is now handled internally in the component

This commit is contained in:
Alejandro Celaya
2021-12-24 13:39:51 +01:00
parent 57075c581d
commit 275aee4de2
9 changed files with 10 additions and 72 deletions

View File

@@ -1,8 +1,4 @@
import { buildActionCreator, buildReducer } from '../../utils/helpers/redux';
import { Order } from '../../utils/helpers/ordering';
import { LIST_SHORT_URLS, ListShortUrlsAction } from './shortUrlsList';
export const RESET_SHORT_URL_PARAMS = 'shlink/shortUrlsListParams/RESET_SHORT_URL_PARAMS';
export const SORTABLE_FIELDS = {
dateCreated: 'Created at',
@@ -15,20 +11,3 @@ export const SORTABLE_FIELDS = {
export type OrderableFields = keyof typeof SORTABLE_FIELDS;
export type ShortUrlsOrder = Order<OrderableFields>;
export interface ShortUrlsListParams {
page?: string;
itemsPerPage?: number;
orderBy?: ShortUrlsOrder;
}
const initialState: ShortUrlsListParams = {
page: '1',
};
export default buildReducer<ShortUrlsListParams, ListShortUrlsAction>({
[LIST_SHORT_URLS]: (state, { params }) => ({ ...state, ...params }),
[RESET_SHORT_URL_PARAMS]: () => initialState,
}, initialState);
export const resetShortUrlParams = buildActionCreator(RESET_SHORT_URL_PARAMS);