From 9bc93658b339be2fcd4f21d5680b611a0b4b2a2d Mon Sep 17 00:00:00 2001 From: Denzel Date: Fri, 10 Jan 2025 09:44:46 +0300 Subject: [PATCH] =?UTF-8?q?P-89vote=20!!!!=20=D0=9F=D0=B5=D1=80=D0=B2?= =?UTF-8?q?=D1=8B=D0=BC=20=D0=B4=D0=B5=D0=BB=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/utils/axios-api.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 30edc4952..3b6582806 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -88,5 +88,36 @@ async error => { return Promise.reject(error); }) +async function getVotes(status) { + try { + const response = await axiosApiInstance.get('/api/vote/getvotes/', { + params: { + status, + } + }); + return response.data; + } catch (error) { + console.error('Ошибка запроса голосования:', error); + throw error; + } +} + +getVotes('completed') + .then(data => { + console.log('Завершённые голосования:', data); + }) + .catch(err => { + console.error('Ошибка:', err); + }); + +getVotes('active') + .then(data => { + console.log('Активные голосования:', data); + }) + .catch(err => { + console.error('Ошибка:', err); + }); + + export { axiosApiInstance, clearAxios, baseURL,spravURL, spravURLBase, baseWS }