Fix sorting input typing
This commit is contained in:
parent
36501a7131
commit
e4397b1f75
1 changed files with 12 additions and 4 deletions
|
@ -79,8 +79,16 @@ export function createGetSortQueryVariables<
|
||||||
>(
|
>(
|
||||||
getSortQueryField: GetSortQueryField<TUrlField, TSortField>
|
getSortQueryField: GetSortQueryField<TUrlField, TSortField>
|
||||||
): GetSortQueryVariables<TSortField, TParams> {
|
): GetSortQueryVariables<TSortField, TParams> {
|
||||||
return (params: TParams) => ({
|
return (params: TParams) => {
|
||||||
|
const field = getSortQueryField(params.sort);
|
||||||
|
|
||||||
|
if (!!field) {
|
||||||
|
return {
|
||||||
direction: getOrderDirection(params.asc),
|
direction: getOrderDirection(params.asc),
|
||||||
field: getSortQueryField(params.sort)
|
field
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue