fix: avoid caching project listings
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user