mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-08-02 09:01:52 +00:00
Updated Short URLs list so that it allows setting default orderBy from settings
This commit is contained in:
@@ -7,7 +7,6 @@ import { GetState } from '../../container/types';
|
||||
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
|
||||
import { ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api/types';
|
||||
import { DeleteShortUrlAction, SHORT_URL_DELETED } from './shortUrlDeletion';
|
||||
import { ShortUrlsListParams } from './shortUrlsListParams';
|
||||
import { CREATE_SHORT_URL, CreateShortUrlAction } from './shortUrlCreation';
|
||||
import { SHORT_URL_EDITED, ShortUrlEditedAction } from './shortUrlEdition';
|
||||
|
||||
@@ -25,7 +24,7 @@ export interface ShortUrlsList {
|
||||
|
||||
export interface ListShortUrlsAction extends Action<string> {
|
||||
shortUrls: ShlinkShortUrlsResponse;
|
||||
params: ShortUrlsListParams;
|
||||
params: ShlinkShortUrlsListParams;
|
||||
}
|
||||
|
||||
export type ListShortUrlsCombinedAction = (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { buildActionCreator, buildReducer } from '../../utils/helpers/redux';
|
||||
import { Order, OrderDir } from '../../utils/helpers/ordering';
|
||||
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';
|
||||
@@ -16,17 +16,14 @@ export type OrderableFields = keyof typeof SORTABLE_FIELDS;
|
||||
|
||||
export type ShortUrlsOrder = Order<OrderableFields>;
|
||||
|
||||
export type OrderBy = Partial<Record<OrderableFields, OrderDir>>;
|
||||
|
||||
export interface ShortUrlsListParams {
|
||||
page?: string;
|
||||
itemsPerPage?: number;
|
||||
orderBy?: OrderBy;
|
||||
orderBy?: ShortUrlsOrder;
|
||||
}
|
||||
|
||||
const initialState: ShortUrlsListParams = {
|
||||
page: '1',
|
||||
orderBy: { dateCreated: 'DESC' },
|
||||
};
|
||||
|
||||
export default buildReducer<ShortUrlsListParams, ListShortUrlsAction>({
|
||||
|
||||
Reference in New Issue
Block a user