Skip to content

Commit 8ba3c3b

Browse files
committed
fix option sort order
1 parent 368b5cc commit 8ba3c3b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/helpers/requestParams.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ export const GetRequestParams = (query: Record<string, any>): RequestParams => {
1414
const offset = limit * (page - 1)
1515
let { q, sort_order, sort_by } = query
1616

17-
if (!['ASC', 'DESC'].includes(sort_order)) {
18-
sort_order = 'ASC'
17+
if (!/asc|desc/i.test(sort_order)) {
18+
sort_order = 'asc'
1919
}
2020

21+
2122
return {
2223
...query,
2324
page,

0 commit comments

Comments
 (0)