refactor: 收口 Admin 会话与授权边界
This commit is contained in:
1 parent
0788480ce3
commit
4ef4be2071
67 files changed
+1890
-392
No files matched your search
@@ -2,7 +2,6 @@ import { CloudUploadOutlined, DeleteOutlined, PictureOutlined } from "@ant-desig
|
||||
import { Alert, Button, Image, Popconfirm, Spin, Upload, message } from "antd";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { apiBaseUrl, authenticatedFetch, createApiClient } from "../lib/api.js";
|
||||
import { readAdminToken } from "../lib/auth-storage.js";
|
||||
|
||||
interface ImageUrlFieldProps {
|
||||
id?: string;
|
||||
@@ -57,10 +56,7 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
||||
: presign.uploadUrl;
|
||||
const response = await authenticatedFetch(uploadUrl, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"content-type": file.type,
|
||||
...(isLocalUpload ? { authorization: `Bearer ${readAdminToken() ?? ""}` } : {}),
|
||||
},
|
||||
headers: { "content-type": file.type },
|
||||
body: file,
|
||||
});
|
||||
if (!response.ok) throw new Error(`upload failed: ${response.status}`);
|
||||
|
||||
Reference in new issue
Block a user