forked from sagnik/Velocity-OS
fix: complete Velocity-OS feature migration wiring
This commit is contained in:
@@ -18,6 +18,14 @@ export function unwrapArray<T>(payload: unknown, keys: string[] = []): T[] {
|
||||
if (Array.isArray(candidate)) return candidate as T[];
|
||||
}
|
||||
|
||||
for (const key of ['data', 'result', 'payload', 'body']) {
|
||||
const candidate = payload[key];
|
||||
if (isRecord(candidate)) {
|
||||
const nested = unwrapArray<T>(candidate, keys);
|
||||
if (nested.length > 0) return nested;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user