feat: refactor service API schema and update layout structure

This commit is contained in:
nguyenvanbao
2026-02-03 16:24:55 +07:00
parent a2a215dfd7
commit adef27b214
6 changed files with 92 additions and 84 deletions

View File

@@ -1,5 +1,13 @@
export const imageUrl = (path?: string) => {
if (!path) return "";
// Không có ảnh → ảnh mặc định
if (!path) return "/_images/default.jpg";
// Đã là full URL
if (path.startsWith("http")) return path;
return `${process.env.NEXT_PUBLIC_API_URL}/${path}`;
const base = (
process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001"
).replace(/\/$/, "");
return `${base}/${path.replace(/^\//, "")}`;
};