This commit is contained in:
hailin 2025-06-15 23:42:36 +08:00
parent 8e0b0ed369
commit d9415a9b37
1 changed files with 8 additions and 1 deletions

View File

@ -389,6 +389,13 @@ export function DetailPageHeader({ data }: { data: any }) {
const userData = JSON.parse(localStorage.getItem("UserData") || "null");
const userName = userData?.user_name;
const id = data?.id;
if (!userName || !id) {
setStatusText("缺少组件 ID 或用户信息");
return;
}
if (!userName) {
setStatusText("未登录,跳转中...");
window.location.href = "/auth/sign-in/";
@ -401,7 +408,7 @@ export function DetailPageHeader({ data }: { data: any }) {
const res = await fetch(endpoint, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ user_name: userName, id: data.id }),
body: JSON.stringify({ user_name: userName, id: id }),
});
const json = await res.json();