fix: avoid caching project listings
This commit is contained in:
@@ -112,12 +112,20 @@ export default function Home() {
|
||||
|
||||
const fetchProjects = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/projects?status=published&take=3', { signal: controller.signal });
|
||||
const response = await fetch('/api/projects?status=published&take=3', {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
credentials: 'same-origin',
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Falha ao buscar projetos mais recentes');
|
||||
throw new Error(`Falha ao buscar projetos mais recentes (status ${response.status})`);
|
||||
}
|
||||
const data: PortfolioProject[] = await response.json();
|
||||
if (isMounted) {
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (isMounted && Array.isArray(data)) {
|
||||
setLatestProjects(data);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user