fix: 修复本地图片上传与发布进程切换
This commit is contained in:
1 parent
7f67f4d685
commit
dcf1d76944
7 files changed
+121
-25
No files matched your search
@@ -52,7 +52,12 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
||||
});
|
||||
const response = await fetch(presign.uploadUrl, {
|
||||
method: "PUT",
|
||||
headers: { "content-type": file.type },
|
||||
headers: {
|
||||
"content-type": file.type,
|
||||
...(presign.uploadUrl.startsWith("/api/")
|
||||
? { authorization: `Bearer ${localStorage.getItem("adminToken") ?? ""}` }
|
||||
: {}),
|
||||
},
|
||||
body: file,
|
||||
});
|
||||
if (!response.ok) throw new Error(`upload failed: ${response.status}`);
|
||||
|
||||
Reference in new issue
Block a user