Fix problem with reactive property and use computed to get the length of the rooms

This commit is contained in:
Pawel Kowalski 2018-08-23 16:36:36 +02:00
parent 8fc0b07eb1
commit a68122f3e7
2 changed files with 17 additions and 12 deletions

View File

@ -41,7 +41,6 @@
} }
} }
} }
} }
</script> </script>

View File

@ -9,7 +9,7 @@
<div class="room__meta"> <div class="room__meta">
<room-group-widget :group="'Fábrica Nacional de Moneda y Timbre'"></room-group-widget> <room-group-widget :group="'Fábrica Nacional de Moneda y Timbre'"></room-group-widget>
<room-entry-count-widget :entry-count="room.roomEntries.length"></room-entry-count-widget> <room-entry-count-widget :entry-count="roomEntryCount"></room-entry-count-widget>
</div> </div>
</div> </div>
<div class="room__content"> <div class="room__content">
@ -47,27 +47,33 @@
this.$store.dispatch('setSpecialContainerClass', 'red'); this.$store.dispatch('setSpecialContainerClass', 'red');
}, },
data() {
return {
room: []
}
},
computed: {
roomEntryCount() {
return (this.room && this.room.roomEntries) ? this.room.roomEntries.length : 0
}
},
apollo: { apollo: {
modules: { modules: {
query: ROOM_ENTRIES_QUERY, query: ROOM_ENTRIES_QUERY,
variables: { variables() {
slug: this.slug return {
// slug: "ein-historisches-festival" slug: this.slug
}
}, },
manual: true, manual: true,
result({data, loading, networkStatus}) { result({data, loading, networkStatus}) {
if (!loading) { if (!loading) {
debugger
this.room = this.$getRidOfEdges(data).room this.room = this.$getRidOfEdges(data).room
} }
} }
} }
},
data() {
return {
room: []
}
} }
// data() { // data() {