fix: restore relative API paths and dev proxy settings matching main branch

This commit is contained in:
이태훈
2026-06-22 13:19:12 +09:00
parent 4c34edd31c
commit 197d5e1f0b
2 changed files with 7 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import { state, saveAsset, deleteAsset } from '../../core/state';
import { ASSET_SCHEMA, UI_TEXT } from '../../core/schema';
import { calculatePcScoreDeductive, getPcGrade } from '../../core/utils';
import { calculatePcScoreDeductive, getPcGrade, API_BASE_URL } from '../../core/utils';
import {
generateOptionsHTML,
setFieldValue,
@@ -728,7 +728,7 @@ class HwAssetModal extends BaseModal {
private async fetchMapConfig() {
try {
const res = await fetch(`http://${location.hostname}:3000/api/maps`);
const res = await fetch(`${API_BASE_URL}/api/maps`);
this.dynamicMapConfig = await res.json();
} catch (err) { console.error('Failed to fetch map config:', err); }
}
@@ -925,7 +925,7 @@ class HwAssetModal extends BaseModal {
private async fetchMasterComponents(): Promise<void> {
try {
const res = await fetch(`http://${location.hostname}:3000/api/hardware-components`);
const res = await fetch(`${API_BASE_URL}/api/hardware-components`);
this.masterComponents = await res.json();
} catch (err) { console.error('Failed to fetch master components:', err); }
}

View File

@@ -1,17 +1,19 @@
import { defineConfig } from 'vite';
import { resolve } from 'path';
const proxyTarget = process.env.VITE_DEV_PROXY_TARGET || 'http://localhost:3000';
export default defineConfig({
server: {
port: 8080,
host: true, // Listen on all local IPs
proxy: {
'/api': {
target: 'http://localhost:3000',
target: proxyTarget,
changeOrigin: true,
},
'/uploads': {
target: 'http://localhost:3000',
target: proxyTarget,
changeOrigin: true,
}
}