frontend api fix

This commit is contained in:
2025-10-12 18:55:58 +02:00
parent 1cc230985f
commit 3f0c607383
2 changed files with 4 additions and 10 deletions
+3 -1
View File
@@ -27,7 +27,9 @@ const runtimeApiBase =
? window.__PAPERCRATE_API_BASE_URL
: '';
const API_ROOT = (runtimeApiBase || process.env.API_BASE_URL || '').replace(/\/$/, '');
const DEFAULT_DEV_API = 'http://127.0.0.1:3000';
const API_ROOT = (runtimeApiBase || process.env.API_BASE_URL || DEFAULT_DEV_API).replace(/\/$/, '');
const api = axios.create({
baseURL: API_ROOT ? `${API_ROOT}/api` : '/api',
+1 -9
View File
@@ -7,8 +7,7 @@ const env = dotenv.config({ path: path.resolve(__dirname, '.env.local') }).parse
const DEFAULT_DEV_API = 'http://127.0.0.1:3000';
const API_BASE_URL = env.API_BASE_URL || process.env.API_BASE_URL || '';
const devServerApiTarget = API_BASE_URL || DEFAULT_DEV_API;
const API_BASE_URL = env.API_BASE_URL || process.env.API_BASE_URL || DEFAULT_DEV_API;
module.exports = {
entry: './src/index.jsx',
@@ -49,13 +48,6 @@ module.exports = {
port: 5173,
historyApiFallback: true,
open: true,
proxy: [
{
context: ['/api'],
target: devServerApiTarget,
changeOrigin: true,
},
],
},
devtool: 'source-map',
resolve: {