Commit 5005b25a by 江名洋

fix: 使用相对路径修复 API 请求路由问题

1 parent 24605b34
...@@ -104,7 +104,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -104,7 +104,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (type) currentHistoryType = type; if (type) currentHistoryType = type;
try { try {
const historyRes = await fetch('api/etl/history?limit=15'); const historyRes = await fetch('./api/etl/history?limit=15');
const history = await historyRes.json(); const history = await historyRes.json();
const tbody = document.getElementById('history-tbody'); const tbody = document.getElementById('history-tbody');
tbody.innerHTML = ''; tbody.innerHTML = '';
...@@ -162,7 +162,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -162,7 +162,7 @@ document.addEventListener('DOMContentLoaded', () => {
btn.textContent = '任务已启动...'; btn.textContent = '任务已启动...';
try { try {
const res = await fetch('api/etl/run-ods', { method: 'POST' }); const res = await fetch('./api/etl/run-ods', { method: 'POST' });
const data = await res.json(); const data = await res.json();
if (data.status === 'success') { if (data.status === 'success') {
setTimeout(() => { btn.disabled = false; btn.textContent = '立即同步 ODS'; }, 2000); setTimeout(() => { btn.disabled = false; btn.textContent = '立即同步 ODS'; }, 2000);
...@@ -199,7 +199,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -199,7 +199,7 @@ document.addEventListener('DOMContentLoaded', () => {
btn.textContent = '加工中...'; btn.textContent = '加工中...';
try { try {
const res = await fetch('api/etl/run-dw', { method: 'POST', body: formData }); const res = await fetch('./api/etl/run-dw', { method: 'POST', body: formData });
const data = await res.json(); const data = await res.json();
if (data.status === 'success') { if (data.status === 'success') {
setTimeout(() => { btn.disabled = false; btn.textContent = '开始加工'; }, 2000); setTimeout(() => { btn.disabled = false; btn.textContent = '开始加工'; }, 2000);
...@@ -368,7 +368,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -368,7 +368,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (hasEcology) uploadForm.append('ecology_factory_file', ecologyFactoryInput.files[0]); if (hasEcology) uploadForm.append('ecology_factory_file', ecologyFactoryInput.files[0]);
if (hasNature) uploadForm.append('nature_factory_file', natureFactoryInput.files[0]); if (hasNature) uploadForm.append('nature_factory_file', natureFactoryInput.files[0]);
const uploadRes = await fetch('api/analysis/upload', { const uploadRes = await fetch('./api/analysis/upload', {
method: 'POST', method: 'POST',
body: uploadForm body: uploadForm
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!