chore: proxy backend routes via Next rewrites

This commit is contained in:
taDuc
2026-05-10 02:55:45 +07:00
parent b3e765b6f1
commit 0d6599015b
4 changed files with 37 additions and 6 deletions
+4 -2
View File
@@ -1,6 +1,8 @@
export const API_URL_ROOT = process.env.NEXT_PUBLIC_API_URL_ROOT || "";
export const URL_MEDIA = process.env.NEXT_PUBLIC_URL_MEDIA || "";
export const HOME_URL = process.env.NEXT_PUBLIC_HOME_URL || "http://localhost:3000";
export const HOME_URL =
process.env.NEXT_PUBLIC_HOME_URL ||
(typeof window !== "undefined" ? window.location.origin : "");
export const API = {
User : {
CURRENT: `${API_URL_ROOT}/users/current`,
@@ -70,4 +72,4 @@ export const API = {
GET_ALL: `${API_URL_ROOT}/statistics`,
GET_BY_DATE: (date: string) => `${API_URL_ROOT}/statistics/${date}`,
}
}
}