Skip to content

Commit

Permalink
Merge pull request #65 from antonioalmeida/vue
Browse files Browse the repository at this point in the history
Fix urgent bug - sorry not sorry
  • Loading branch information
antonioalmeida authored May 30, 2018
2 parents 1dcdd04 + d5cfbd1 commit 4c102f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
5 changes: 5 additions & 0 deletions presto/app/Http/Resources/TopicResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function toArray($request)

$response['questions'] = QuestionResource::collection($this->questions);

if (Auth::user() != null)
$response['isModerator'] = Auth::user()->is_moderator;
else
$response['isModerator'] = false;

return $response;
}
}
Binary file added presto/resources/.DS_Store
Binary file not shown.
13 changes: 1 addition & 12 deletions presto/resources/assets/js/views/Topic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
>
</follow-button>

<router-link v-if="this.member.is_moderator" :to="'/topic/'+topic.name+'/edit'" class="btn btn-outline-light">
<router-link v-if="this.topic.isModerator" :to="'/topic/'+topic.name+'/edit'" class="btn btn-outline-light">
Edit Topic
</router-link>

Expand Down Expand Up @@ -154,7 +154,6 @@
mounted() {
this.loader = this.$loading.show();
this.getTopic(this.name);
this.getMember();
},
watch: {
Expand Down Expand Up @@ -182,16 +181,6 @@
.catch((error) => {
console.log(error);
});
},
getMember: function () {
axios.get('/api/profile/')
.then(({data}) => {
this.member = data;
})
.catch((error) => {
this.member.is_moderator = false; //In case not logged in
});
}
},
Expand Down

0 comments on commit 4c102f9

Please sign in to comment.