Skip to content

Commit

Permalink
Ajustando butão do like
Browse files Browse the repository at this point in the history
Ajustando butão do like
  • Loading branch information
Cleibson Gomes da Silva committed Mar 9, 2020
1 parent e4f3bdd commit 87f60b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions SPA/social/src/components/social/CardConteudoVue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
</div>
<div class="card-action right-align">
<p>
<a v-on:click="like()" class="btn-floating blue-grey pulse">
<i class="material-icons">{{liked}}</i>
<span class="new badge blue-grey">12</span>
</a>
<a class="btn-floating blue-grey"><i class="material-icons">insert_comment</i></a>
<a class="btn-floating blue-grey pulse"><i class="material-icons">favorite_border</i></a>
</p>
</div>

Expand All @@ -39,7 +42,16 @@
},
data () {
return {
liked : 'favorite'
}
},
methods : {
like() {
if (this.liked === 'favorite') {
this.liked = 'favorite_border';
} else {
this.liked = 'favorite';
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions SPA/social/src/pages/home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
}
})
.then( response => {
if (response.status === 200 && response.data) {
this.$store.commit("setConteudosTemp", response.data);
if (response.status === 200 && response.data && response.data.content) {
this.$store.commit("setConteudosTemp", response.data.content);
}
} )
.catch( e => {
Expand Down

0 comments on commit 87f60b0

Please sign in to comment.