feat(assist): handle nested response
This commit is contained in:
parent
738217d979
commit
33f2d2de59
1 changed files with 7 additions and 0 deletions
|
|
@ -174,6 +174,13 @@ const getValue = function (obj, key) {
|
|||
return undefined;
|
||||
}
|
||||
const sortPaginate = function (list, filters) {
|
||||
if (typeof (list) === "object" && !Array.isArray(list)) {
|
||||
for (const [key, value] of Object.entries(list)) {
|
||||
list[key] = sortPaginate(value, filters);
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
const total = list.length;
|
||||
list.sort((a, b) => {
|
||||
const tA = getValue(a, "timestamp");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue