fix customer ws subscription

This commit is contained in:
2026-04-15 20:57:50 -06:00
parent 51829dd833
commit b08d1d29ae
2 changed files with 10 additions and 4 deletions

View File

@@ -114,7 +114,10 @@ function AiChatPage() {
lastMessageIdRef.current = msg.id;
} catch { /* silent */ }
});
client.subscribe(`/topic/chat/conversations`, (frame) => {
const convTopic = user?.role === "CUSTOMER"
? `/user/queue/chat/conversations`
: `/topic/chat/conversations`;
client.subscribe(convTopic, (frame) => {
try {
const conv = JSON.parse(frame.body);
if (conv.id === convId) setConversation(conv);
@@ -124,7 +127,7 @@ function AiChatPage() {
};
stompRef.current = client;
client.activate();
}, [token]);
}, [token, user?.role]);
useEffect(() => {
if (!token || authLoading) return;