Vite için API taban URL’sini .env üzerinden okuyacak şekilde yapılandır.

This commit is contained in:
2025-10-26 19:26:55 +03:00
parent 97e7404e81
commit 426a1302fc
2 changed files with 5 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
export const API = import.meta.env.VITE_API || "http://dupe.panda";
const apiBase = import.meta.env.VITE_API;
export const API = apiBase || window.location.origin;
// 🔐 Ortak kimlik doğrulama başlığı (token varsa ekler)
export function authHeaders() {
@@ -17,4 +18,4 @@ export async function apiFetch(path, options = {}) {
window.location.reload();
}
return res;
}
}