From 56296b6b38dc6dbc13ea0257decab85777ebecdf Mon Sep 17 00:00:00 2001 From: JimmyLv Date: Thu, 2 Mar 2023 10:48:42 +0800 Subject: [PATCH] fix: add bvId --- pages/[...slug].tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 0b8ee290..1ca4db38 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -19,6 +19,7 @@ export const Home: NextPage = () => { const router = useRouter(); const urlState = router.query.slug; const [summary, setSummary] = useState(""); + const [bvId, setBvId] = useState(""); const [loading, setLoading] = useState(false); const [curVideo, setCurVideo] = useState(""); const [apiKey, setAPIKey] = useLocalStorage("user-openai-apikey"); @@ -61,9 +62,8 @@ export const Home: NextPage = () => { const videoUrl = url ? url : curVideo; const matchResult = videoUrl.match(/\/video\/([^\/\?]+)/); - let bvId: string | undefined; if (matchResult) { - bvId = matchResult[1]; + setBvId(matchResult[1]); } else { return toast.error("暂不支持此视频链接"); } @@ -231,7 +231,7 @@ export const Home: NextPage = () => { target="_blank" rel="noreferrer" > - 【📝 总结】 + {`【📝 总结:${bvId}】`}