chore: crud 的 api 返回容忍返回为空 null Close: #6391 (#7275)

This commit is contained in:
liaoxuezhi 2023-06-28 18:39:00 +08:00 committed by GitHub
parent 40c9592c9c
commit 58bb8d6466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,8 +289,10 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
items = result.items || result.rows;
}
if (items == null) {
items = [];
} else if (!Array.isArray(items)) {
// 如果不按照 items 格式返回,就拿第一个数组当成 items
if (!Array.isArray(items)) {
for (const key of Object.keys(result)) {
if (result.hasOwnProperty(key) && Array.isArray(result[key])) {
items = result[key];