fix: share chat

This commit is contained in:
archer
2023-06-27 21:00:15 +08:00
parent 3d2043c16f
commit 62489ef12f
3 changed files with 30 additions and 21 deletions

View File

@@ -62,7 +62,7 @@ const textareaMinH = '22px';
const Chat = () => {
const router = useRouter();
const { shareId = '', historyId = '' } = router.query as { shareId: string; historyId: string };
const { shareId = '', historyId } = router.query as { shareId: string; historyId: string };
const theme = useTheme();
const ChatBox = useRef<HTMLDivElement>(null);
@@ -491,14 +491,13 @@ const Chat = () => {
]);
// 初始化聊天框
useQuery(['init', historyId], () => {
useQuery(['init', shareId, historyId], () => {
if (!shareId) {
return null;
}
if (!historyId) {
router.replace(`/chat/share?shareId=${shareId}&historyId=${new Types.ObjectId()}`);
return null;
return router.replace(`/chat/share?shareId=${shareId}&historyId=${new Types.ObjectId()}`);
}
return loadChatInfo();