mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-07-20 18:51:53 +00:00
Updated Short URLs list so that it allows setting default orderBy from settings
This commit is contained in:
@@ -24,12 +24,11 @@ const buildShlinkBaseUrl = (url: string, apiVersion: number) => url ? `${url}/re
|
||||
const rejectNilProps = reject(isNil);
|
||||
const normalizeOrderByInParams = (params: ShlinkShortUrlsListParams): ShlinkShortUrlsListNormalizedParams => {
|
||||
const { orderBy = {}, ...rest } = params;
|
||||
const [ firstKey ] = Object.keys(orderBy);
|
||||
const [ firstValue ] = Object.values(orderBy);
|
||||
const { field, dir } = orderBy;
|
||||
|
||||
return !firstValue ? rest : {
|
||||
return !dir ? rest : {
|
||||
...rest,
|
||||
orderBy: `${firstKey}-${firstValue}`,
|
||||
orderBy: `${field}-${dir}`,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user