Skip to content

Commit

Permalink
post coment, list event
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolopeshlsSENAI committed Oct 14, 2020
1 parent 2b98aeb commit 54d0d10
Showing 1 changed file with 41 additions and 27 deletions.
68 changes: 41 additions & 27 deletions src/components/cpmCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<v-card
v-if="cardData"
class="rounded-xl ac"
class="rounded-xl ac mb-5"
max-height="900px"
max-width="600px"
>
Expand Down Expand Up @@ -53,6 +53,7 @@
</v-avatar>

{{ comment.user.name }} - {{ comment.comment }}

</div>

</div>
Expand Down Expand Up @@ -116,37 +117,50 @@ export default {
},
methods: {
createComent(param) {
if (!this.newComent) {
this.$toast.error("Verifique se existe algum campo vazio", "Atenção!", {
position: "topCenter",
});
} else {
let body = {
comment: this.newComent,
};
let eventId = param.id;
// this.$http.post(this.url + `/comment/${eventId}`, body).then(resp => {
// console.log(resp)
// })
axios
.post(this.url + `/comment/${eventId}`, body)
.then((resp) => {
// console.log(resp)
})
.catch((err) => {
this.$toast.error("Erro no registro!", "Putz", {
position: "topCenter",
...mapActions({
getEvents: 'FeedVuex/getEvents'
}),
createComent(param) {
if (!this.newComent) {
this.$toast.error("Verifique se existe algum campo vazio", "Atenção!", {
position: "topCenter",
});
});
}
},
} else {
let body = {
comment: this.newComent,
};
let eventId = param.id;
// this.$http.post(this.url + `/comment/${eventId}`, body).then(resp => {
// console.log(resp)
// })
axios
.post(this.url + `/comment/${eventId}`, body)
.then((resp) => {
if(resp.data != ''){
this.getEvents()
this.newComent = ''
this.$toast.success("evento comentado!", "💥", {
position: "topCenter",
});
}
})
.catch((err) => {
this.$toast.error("Erro no registro!", "Putz", {
position: "topCenter",
});
});
}
},
},
created() {
// this.cardDataArray.push(this.cardData)
console.log("odsadiosaiodjsioajdiosajdiosa");
console.log(this.cardData.comments);
},
};
Expand Down

0 comments on commit 54d0d10

Please sign in to comment.