Skip to content

Commit 92bbfd6

Browse files
authored
Merge pull request #167 from Lemoncode/feature/fix-equipo
fix team
2 parents 04a1a4f + b7e3c5d commit 92bbfd6

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

front/src/pods/equipo/api/equipo.api.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@ import { unstable_cache } from "next/cache";
33
import type { Developer } from "./equipo.api-model";
44
import { contentIslandClient } from "@/lib";
55

6-
export const getDeveloperListCached = unstable_cache(
7-
async (): Promise<Developer[]> => {
8-
try {
9-
return await contentIslandClient.getContentList<Developer>({
10-
contentType: "developer",
11-
language: "es",
12-
});
13-
} catch (error) {
14-
console.warn("Warning: developer list not available");
15-
return [];
16-
}
17-
},
6+
const fetchDeveloperList = async (): Promise<Developer[]> => {
7+
const result = await contentIslandClient.getContentList<Developer>({
8+
contentType: "developer",
9+
language: "es",
10+
});
11+
12+
if (!result?.length) {
13+
throw new Error("Empty developer list, skipping cache");
14+
}
15+
16+
return result;
17+
};
18+
19+
const fetchDeveloperListCached = unstable_cache(
20+
fetchDeveloperList,
1821
["developer-list"],
1922
{ revalidate: 60 }
2023
);
24+
25+
export const getDeveloperListCached = async (): Promise<Developer[]> => {
26+
try {
27+
return await fetchDeveloperListCached();
28+
} catch (error) {
29+
console.warn("Warning: developer list not available");
30+
return [];
31+
}
32+
};

0 commit comments

Comments
 (0)