feat(navigation): 为数字人前台拆分独立页面路由
- 新增对话列表、聊天、角色详情、书架详情及个人资料独立路由 - 导航使用真实链接,补齐历史返回、登录深链与会话草稿恢复 - 搜索筛选由 URL 驱动,修复浏览器返回时丢失筛选的问题 - 补齐路由校验回归、页面加载与异常入口,并同步 README
This commit is contained in:
@@ -2,11 +2,12 @@
|
||||
|
||||
/** 独立星港用户账号登录,成功后进入数字人空间。 */
|
||||
import { useRouter } from "next/navigation";
|
||||
import { safeDigitalReturnTo } from "@/lib/digital-routes";
|
||||
import { Eye, EyeOff, LockKeyhole, Smartphone } from "lucide-react";
|
||||
import { FormEvent, useState } from "react";
|
||||
|
||||
/** 独立用户的登录表单,不保存明文密码。 */
|
||||
export function LoginForm() {
|
||||
export function LoginForm({ returnTo = "/discover" }: { returnTo?: string }) {
|
||||
const router = useRouter();
|
||||
const [error, setError] = useState("");
|
||||
const [pending, setPending] = useState(false);
|
||||
@@ -31,7 +32,7 @@ export function LoginForm() {
|
||||
const payload = await response.json().catch(() => null);
|
||||
throw new Error(payload?.message || "登录失败,请检查账号和密码");
|
||||
}
|
||||
router.replace("/discover");
|
||||
router.replace(safeDigitalReturnTo(returnTo));
|
||||
router.refresh();
|
||||
} catch (error) {
|
||||
setError(
|
||||
|
||||
Reference in New Issue
Block a user