From c3a912f9ebc01ed827918160961c8bdd691abd31 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Mon, 13 Mar 2023 09:19:08 +0100 Subject: [PATCH] MT#55336 Add support for items that returned from a non array API Change-Id: I8f019a3b1c0b9d3daed6e1ad7fc6dc9a36a11c39 --- src/api/common.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/common.js b/src/api/common.js index 06f494e9..065c7a30 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -94,7 +94,10 @@ export async function getList (options) { if (lastPage === 0) { lastPage = null } - const items = _.get(body, options.root, []) + let items = _.get(body, options.root, []) + if (!Array.isArray(items)) { + items = [items] + } for (let i = 0; i < items.length; i++) { items[i] = normalizeEntity(items[i]) }