From 27759c35f89eb98ce8873fb1d45630410201e559 Mon Sep 17 00:00:00 2001 From: ka-lucas Date: Thu, 17 Apr 2025 11:21:23 -0300 Subject: [PATCH] consumo de dados feriado ok --- src/stores/holiday.js | 11 +++++++---- src/views/Holiday.vue | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/stores/holiday.js b/src/stores/holiday.js index 33a91d7..c361ea7 100644 --- a/src/stores/holiday.js +++ b/src/stores/holiday.js @@ -26,19 +26,21 @@ export const useHolidayStore = defineStore('holidays', { /** * Busca os feriados registrados na API */ + async fetchHolidays() { - /*const authStore = useAuthStore(); + const authStore = useAuthStore(); const serviceInstanceId = authStore.getInstance; if (!serviceInstanceId) { this.error = 'Nenhuma instância de serviço selecionada'; return; - }*/ + } this.loading = true; this.error = null; try { + console.log('cheguei aqui3'); const response = await api.get('/holiday/', { params: {} }); @@ -50,6 +52,7 @@ export const useHolidayStore = defineStore('holidays', { console.log(response.data); return response.data; + } catch (error) { const status = error?.response?.status; @@ -68,8 +71,8 @@ export const useHolidayStore = defineStore('holidays', { async getHolidays() { const response = await api.get('/holiday/'); - console.log('Holidays', response.data); - return response.data; + console.log('Holidays', response.data.holiday_list); + return response.data.holiday_list; }, /** diff --git a/src/views/Holiday.vue b/src/views/Holiday.vue index 3f64c61..308cf33 100644 --- a/src/views/Holiday.vue +++ b/src/views/Holiday.vue @@ -424,11 +424,13 @@ onMounted(async () => { try { loading.value.holidays = true; + console.log('cheguei aqui') const holidaysData = await holidayStore.getHolidays(); + console.log("Dados recebidos da API:", holidaysData); // Garanta que os dados já estão filtrados (usuários deletados removidos) - holidays.value = holidaysData.filter(holiday => !holiday.deleted); + //holidays.value = holidaysData.filter(holiday => !holiday.deleted); } catch (error) { showNotification('Erro ao carregar dados da API', 'error'); console.error('Error fetching feriados:', error);