feat: fixing build npm
continuous-integration/drone/push Build is passing Details

This commit is contained in:
hanif salafi 2026-04-10 18:59:01 +07:00
parent 6176567557
commit 5fdc2d4374
2 changed files with 16 additions and 11 deletions

View File

@ -2,7 +2,7 @@
FROM node:20-alpine FROM node:20-alpine
# Mengatur port # Mengatur port
ENV PORT 3000 ENV PORT=3000
# Install pnpm secara global # Install pnpm secara global
RUN npm install -g pnpm RUN npm install -g pnpm

View File

@ -14,14 +14,19 @@ export async function publicFetch<T>(path: string): Promise<T | null> {
const base = apiBase(); const base = apiBase();
if (!base) return null; if (!base) return null;
const url = `${base}${path.startsWith("/") ? path : `/${path}`}`; const url = `${base}${path.startsWith("/") ? path : `/${path}`}`;
const res = await fetch(url, { try {
headers: { const res = await fetch(url, {
"Content-Type": "application/json", headers: {
"X-Client-Key": clientKey(), "Content-Type": "application/json",
}, "X-Client-Key": clientKey(),
next: { revalidate: 60 }, },
}); next: { revalidate: 60 },
if (!res.ok) return null; });
const json = (await res.json()) as { data?: T }; if (!res.ok) return null;
return json.data ?? null; const json = (await res.json()) as { data?: T };
return json.data ?? null;
} catch {
// e.g. ECONNREFUSED during `next build` in Docker when API is not running
return null;
}
} }