update get rid of
This commit is contained in:
parent
e9897911b3
commit
12d8d2375c
|
|
@ -15,14 +15,16 @@ Vue.config.productionTip = false
|
|||
// TODO: Move into a separate project as a plugin
|
||||
//
|
||||
function getRidOfEdges(collection) {
|
||||
if (typeof collection === 'object') {
|
||||
if (typeof collection === 'object' && collection) {
|
||||
let newObj = {}
|
||||
for (const k in collection) {
|
||||
if (k === 'edges') {
|
||||
return collection.edges.map(edge => getRidOfEdges(edge.node));
|
||||
} else {
|
||||
newObj[k] = getRidOfEdges(collection[k])
|
||||
delete newObj[k]['__typename']
|
||||
if (newObj[k]) {
|
||||
delete newObj[k]['__typename']
|
||||
}
|
||||
}
|
||||
}
|
||||
return newObj
|
||||
|
|
|
|||
Loading…
Reference in New Issue