And now also get rid of edges

This commit is contained in:
Pawel Kowalski 2018-08-18 00:40:30 +02:00
parent de14c02f0a
commit d6d8d60c9b
6 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="chapter">
<h3>{{chapter.title}}</h3>
<content-block :contentBlock="contentBlock" :key="contentBlock.id" v-for="contentBlock in chapter.contentBlocks.edges">
<content-block :contentBlock="contentBlock" :key="contentBlock.id" v-for="contentBlock in chapter.contentBlocks">
</content-block>
</div>

View File

@ -8,9 +8,9 @@
</div>
<h3>Lernziele</h3>
<objective-group v-for="group in module.objectivegroupSet.edges" :key="group.id" :group="group"></objective-group>
<objective-group v-for="group in module.objectivegroupSet" :key="group.id" :group="group"></objective-group>
<chapter :chapter="chapter" v-for="chapter in module.chapters.edges" :key="chapter.id"></chapter>
<chapter :chapter="chapter" v-for="chapter in module.chapters" :key="chapter.id"></chapter>
<h3>1.1 Lehrbeginn</h3>
<h4>Das Interview</h4>
<h4>Tipp</h4>

View File

@ -3,7 +3,7 @@
<h4>{{group.title}}</h4>
<ul class="objective-group__objective-list">
<li class="objective-group__objective" v-for="objective in group.objectiveSet.edges" :key="objective.id">
<li class="objective-group__objective" v-for="objective in group.objectiveSet" :key="objective.id">
{{objective.text}}
</li>
</ul>

View File

@ -19,10 +19,11 @@ EdgesNodePlugin.install = function (Vue, options) {
if (typeof collection === 'object') {
let newObj = {}
for (const k in collection) {
if (k === 'node') {
if (k === 'edges' || k === 'node') {
newObj = getRidOfEdges(collection[k])
} else {
newObj[k] = getRidOfEdges(collection[k])
delete newObj[k]['__typename']
}
}
return newObj

View File

@ -16,6 +16,7 @@
</template>
<script>
import Vue from 'vue'
import ALL_MODULES from '@/graphql/gql/allModules.gql'
export default {
@ -32,7 +33,7 @@
manual: true,
result({data, loading, networkStatus}) {
if (!loading) {
this.modules = data.modules.edges.map(node => node.node);
this.modules = Vue.getRidOfEdges(data).modules
}
}
}

View File

@ -19,7 +19,7 @@
result({data, loading, networkStatus}) {
if (!loading) {
const purgedData = Vue.getRidOfEdges(data)
this.module = purgedData.modules.edges[0]
this.module = purgedData.modules[0]
}
}
}