Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
feat: tracks with real data
Browse files Browse the repository at this point in the history
  • Loading branch information
ocjojo committed Mar 22, 2020
1 parent b89056d commit 5e8899d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions frontend/src/views/Track.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<header>
<div class="track-info">
<div class="track-title">{{ track.Name || "Nachhaltigkeit" }}</div>
<div class="track-title">{{ track.Name }}</div>
<div class="track-detailed-info">
<div class="track-users group">23</div>
<div class="track-rating rating">4,5</div>
Expand All @@ -14,7 +14,7 @@
<div class="description">{{ track.Description }}</div>
</section>
<section class="forum">
<h2>Forum - {{ track.Name || "Nachhaltigkeit" }}</h2>
<h2>Forum - {{ track.Name }}</h2>
<div class="new-post-container">
<textarea
name="newComment"
Expand All @@ -34,15 +34,22 @@ export default {
track: {}
};
},
watch: {
$route(to, from) {
console.log(to);
methods: {
getTrack(routeName) {
const getTrack = mapGetters(["track"]).track;
const id = to.params.routeName.substring(0, 1);
const id = routeName.split("-", 2)[0];
this.track = getTrack(id).then(track => {
this.track = track;
});
}
},
created() {
this.getTrack(this.$route.params.routeName);
},
beforeRouteUpdate(to, from, next) {
this.getTrack(to.params.routeName);
next();
}
};
</script>
Expand Down

0 comments on commit 5e8899d

Please sign in to comment.