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