mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
not throw error if sort keyword not found
This commit is contained in:
parent
f915c18dfa
commit
d579a8f907
1 changed files with 7 additions and 7 deletions
|
|
@ -317,18 +317,18 @@ export const buildQuery = (
|
|||
)
|
||||
}
|
||||
case 'sort': {
|
||||
const [sort, sortOrder] = value.split('-')
|
||||
if (sort.toLowerCase() === 'score') {
|
||||
// score is not a column and is handled separately
|
||||
const [sort, sortOrder] = value.toLowerCase().split('-')
|
||||
const matchingSortBy = Object.values(SortBy).find(
|
||||
(sortBy) => sortBy === sort
|
||||
)
|
||||
if (!matchingSortBy) {
|
||||
return null
|
||||
}
|
||||
const column = getColumnName(matchingSortBy)
|
||||
|
||||
const order =
|
||||
sortOrder?.toLowerCase() === 'asc'
|
||||
? SortOrder.ASCENDING
|
||||
: SortOrder.DESCENDING
|
||||
sortOrder === 'asc' ? SortOrder.ASCENDING : SortOrder.DESCENDING
|
||||
|
||||
const column = getColumnName(sort)
|
||||
orders.push({ by: `library_item.${column}`, order })
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue