dashboard: reimaginacao

Signed-off-by: Rodrigo B. de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2025-07-15 19:07:35 -03:00
1 parent 7e868dbc46
commit 6b89a61dd7
3 files changed
+27 -6

No files matched your search

@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
import { useAuth } from '../../contexts/AuthContext';
interface Evento {
id: string;
@@ -8,6 +9,7 @@ interface Evento {
}
export const CalendarioAtendimentos: React.FC = () => {
const { token } = useAuth();
const [eventos, setEventos] = useState<Evento[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
@@ -17,7 +19,12 @@ export const CalendarioAtendimentos: React.FC = () => {
try {
setLoading(true);
setError(null);
const res = await fetch('/api/eventos');
const res = await fetch('/api/eventos', {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
});
if (!res.ok) throw new Error('Erro ao buscar eventos');
const data = await res.json();
setEventos(data);
@@ -28,7 +35,7 @@ export const CalendarioAtendimentos: React.FC = () => {
}
}
fetchEventos();
}, []);
}, [token]);
// Simulação de calendário mensal
const diasMes = Array.from({ length: 30 }, (_, i) => i + 1);