mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-13 15:01:29 +00:00
Merge f688beae54 into 47ea6b5092
This commit is contained in:
commit
a1ef96bfe2
2 changed files with 37 additions and 5 deletions
|
|
@ -1140,8 +1140,14 @@ class LibraryController {
|
|||
})
|
||||
}
|
||||
|
||||
// sorting
|
||||
const key = req.query.sortBy === 'numBooks' ? 'numBooks' : 'name';
|
||||
const order = req.query.sortOrder === 'desc' ? 'desc' : 'asc';
|
||||
const narratorArr = Object.values(narrators);
|
||||
const sorted = naturalSort(narratorArr)[order]((n) => n[key])
|
||||
|
||||
res.json({
|
||||
narrators: naturalSort(Object.values(narrators)).asc((n) => n.name)
|
||||
narrators: sorted
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue