1
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="/assets/index-CXwDXEM6.js"></script>
|
<script type="module" crossorigin src="/assets/index-CeOAp-xS.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-D7ShJUt4.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -139,13 +139,16 @@ export async function uploadPdf(file: File, configKey: string): Promise<{ url: s
|
|||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
formData.append('config_key', configKey);
|
formData.append('config_key', configKey);
|
||||||
const token = localStorage.getItem('auth_token');
|
const token = localStorage.getItem('auth_token');
|
||||||
const baseUrl = (import.meta as any).env?.VITE_API_URL || 'http://localhost:8000/api';
|
const baseUrl = import.meta.env.VITE_API_BASE || 'http://localhost:8000';
|
||||||
const res = await fetch(`${baseUrl}/admin/upload-pdf`, {
|
const res = await fetch(`${baseUrl}/api/admin/upload-pdf`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
|
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('上传失败');
|
if (!res.ok) {
|
||||||
|
const text = await res.text();
|
||||||
|
throw new Error(text || '上传失败');
|
||||||
|
}
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,13 +156,16 @@ export async function uploadLogo(file: File): Promise<{ url: string }> {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
const token = localStorage.getItem('auth_token');
|
const token = localStorage.getItem('auth_token');
|
||||||
const baseUrl = (import.meta as any).env?.VITE_API_URL || 'http://localhost:8000/api';
|
const baseUrl = import.meta.env.VITE_API_BASE || 'http://localhost:8000';
|
||||||
const res = await fetch(`${baseUrl}/admin/upload-logo`, {
|
const res = await fetch(`${baseUrl}/api/admin/upload-logo`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
|
headers: token ? { 'Authorization': `Bearer ${token}` } : {},
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('上传失败');
|
if (!res.ok) {
|
||||||
|
const text = await res.text();
|
||||||
|
throw new Error(text || '上传失败');
|
||||||
|
}
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user