only display the list when there are coaches found

This commit is contained in:
Andreas Zweili 2021-06-27 18:24:43 +02:00
parent 25c054b514
commit 393a98e320
1 changed files with 5 additions and 1 deletions

View File

@ -7,11 +7,12 @@
<button>Refresh</button> <button>Refresh</button>
<router-link to="/register">Register as Coach</router-link> <router-link to="/register">Register as Coach</router-link>
</div> </div>
<ul> <ul v-if="hasCoaches">
<li v-for="coach in filteredCoaches" :key="coach.id"> <li v-for="coach in filteredCoaches" :key="coach.id">
{{ coach.firstName }} {{ coach.firstName }}
</li> </li>
</ul> </ul>
<h3 v-else>No coaches found.</h3>
</section> </section>
</template> </template>
@ -20,6 +21,9 @@ export default {
computed: { computed: {
filteredCoaches() { filteredCoaches() {
return this.$store.getters['coaches/coaches']; return this.$store.getters['coaches/coaches'];
},
hasCoaches() {
return this.$store.getters['coaches/hasCoaches'];
} }
} }
}; };