fix: avoid caching project listings

This commit is contained in:
Erik
2025-11-27 16:35:12 -03:00
parent 1138747565
commit f69e0a10c4
2 changed files with 24 additions and 8 deletions

View File

@@ -31,12 +31,20 @@ export default function ProjetosPage() {
const fetchProjects = async () => {
try {
const response = await fetch('/api/projects?status=published', { signal: controller.signal });
const response = await fetch('/api/projects?status=published', {
method: 'GET',
cache: 'no-store',
credentials: 'same-origin',
signal: controller.signal,
});
if (!response.ok) {
throw new Error('Falha ao buscar projetos');
throw new Error(`Falha ao buscar projetos (status ${response.status})`);
}
const data: Project[] = await response.json();
if (isMounted) {
const data = await response.json();
if (isMounted && Array.isArray(data)) {
setProjects(data);
}
} catch (err) {