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;
}
}

View File

@@ -1,8 +1,10 @@
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import path from 'path';
export default defineConfig({
plugins: [svelte()],
envDir: path.resolve(__dirname, '..'),
server: {
host: '0.0.0.0', // dış erişim
port: 5173,