实现elide基于jsonapi的结果解析
This commit is contained in:
@@ -21,7 +21,7 @@ export function amisRender(target, amisJson) {
|
||||
)
|
||||
}
|
||||
|
||||
function parseEdges (edges) {
|
||||
function parseEdges(edges) {
|
||||
if (isArr(edges)) {
|
||||
|
||||
}
|
||||
@@ -33,9 +33,22 @@ export function amisElideGraphQLAdaptor(payload, response, api, context) {
|
||||
console.log(payload)
|
||||
if (payload.data) {
|
||||
let items = payload.data[Object.keys(payload.data)[0]]['edges']
|
||||
for(let item of items) {
|
||||
for (let item of items) {
|
||||
result.push(item.node)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function amisElideJsonapiAdaptor(payload, response, api, context) {
|
||||
let result = []
|
||||
if (payload.data && isArr(payload.data)) {
|
||||
for (let item of payload.data) {
|
||||
result.push({
|
||||
...item,
|
||||
...item['attributes'],
|
||||
})
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user