Новые изменения в компонентах

This commit is contained in:
Web-serfer 2026-04-22 19:01:09 +05:00
parent 5bb4525f63
commit d4394a7597
5 changed files with 145 additions and 34 deletions

View file

@ -132,6 +132,15 @@ export const POST: APIRoute = async ({ request, cookies }) => {
console.error('[ReviewVote API] Votes error:', errorText);
}
await fetch(`${POCKETBASE_URL}/api/collections/reviews/records/${review_id}`, {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ votesCount: likes }),
});
return new Response(
JSON.stringify({ likes, dislikes, userVote }),
{ status: 200, headers: { 'Content-Type': 'application/json' } }