diff --git a/app/(order)/chat/[id]/page.tsx b/app/(order)/chat/[id]/page.tsx index 1793815..7361bcd 100644 --- a/app/(order)/chat/[id]/page.tsx +++ b/app/(order)/chat/[id]/page.tsx @@ -10,12 +10,14 @@ import { Input } from "@/components/ui/input" import { ScrollArea } from "@/components/ui/scroll-area" import { mockChatMessages, mockChatSessions } from "@/lib/mock-data" import { cn } from "@/lib/utils" +import { useAuthStore } from "@/store/auth" export default function ChatDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = use(params) const session = mockChatSessions.find((s) => s.id === id) const messages = mockChatMessages.filter((m) => m.sessionId === id) const [input, setInput] = useState("") + const { user } = useAuthStore() if (!session) { return ( @@ -25,8 +27,8 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin ) } - const other = session.participants[1] - const currentUserId = session.participants[0].id + const currentUserId = user?.id ?? session.participants[0].id + const other = session.participants.find((p) => p.id !== currentUserId) ?? session.participants[1] return (