Skip to content

Commit 0ee6b74

Browse files
fix: 发布跳转用后端返回的 authorUsername 替代本地 user.username
1 parent abab373 commit 0ee6b74

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

app/[locale]/editor/EditorPageClient.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,8 @@ export function EditorPageClient({ user }: EditorPageClientProps) {
233233
throw new Error(body.message ?? "发布失败,请重试");
234234
}
235235

236-
const { slug: finalSlug } = body.data;
237-
// 跳到文章详情页
238-
router.push(`/u/${user.username}/posts/${finalSlug}`);
236+
const { slug: finalSlug, authorUsername } = body.data;
237+
router.push(`/u/${authorUsername}/posts/${finalSlug}`);
239238
} catch (error) {
240239
console.error("发布失败:", error);
241240
alert(`发布失败:${error instanceof Error ? error.message : "未知错误"}`);

0 commit comments

Comments
 (0)