Skip to content

Commit 1b1174f

Browse files
author
иван Горбунов
committed
создал две функции для заросов и столкнулся с проблемой эндпоинтов
1 parent f9bb933 commit 1b1174f

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

src/components/TheReviewCard.vue

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,16 @@
5656
</v-col>
5757
</template>
5858
<template #actions>
59-
<v-btn density="compact" size="large" prepend-icon="mdi-thumb-up">0</v-btn>
60-
<v-btn density="compact" size="large" prepend-icon="mdi-thumb-down">0</v-btn>
59+
<v-btn
60+
@click="changeReactionLike"
61+
density="compact"
62+
size="large"
63+
prepend-icon="mdi-thumb-up">0</v-btn>
64+
<v-btn
65+
@click="changeReactionDislike"
66+
density="compact"
67+
size="large"
68+
prepend-icon="mdi-thumb-down">0</v-btn>
6169
</template>
6270
</v-card>
6371
</template>
@@ -82,6 +90,34 @@ const emit = defineEmits(['comment-deleted']);
8290
const markGeneral = ref(0);
8391
const redactedText = ref<string[]>([]);
8492
93+
async function changeReactionLike() {
94+
try{
95+
await apiClient.PUT('/rating/comment/{uuid}/{reaction}', {
96+
params: {
97+
path: {
98+
uuid: propsLocal.comment.raw.uuid,
99+
reaction: "like"
100+
}
101+
},
102+
});
103+
104+
}catch(error){
105+
console.error("Ошибка лайка:", error)
106+
}
107+
108+
}
109+
async function changeReactionDislike() {
110+
try{
111+
await apiClient.PUT('/rating/comment/{uuid}/{reaction}', {
112+
params: { path: { uuid: propsLocal.comment.raw.uuid,
113+
reaction: "dislike"} },
114+
});
115+
}catch(error){
116+
console.error("Ошибка дизлайка:", error)
117+
}
118+
119+
}
120+
85121
async function deleteComment() {
86122
await apiClient.DELETE('/rating/comment/{uuid}', {
87123
params: { path: { uuid: propsLocal.comment.raw.uuid } },

0 commit comments

Comments
 (0)