Skip to content

Commit f9f0864

Browse files
committed
feat(fe): disconnect socket on session termination
1 parent 914020a commit f9f0864

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/client/src/components/qna/QuestionList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { IoClose, IoShareSocialOutline } from 'react-icons/io5';
66

77
import { useModal } from '@/features/modal';
88
import { postSessionTerminate, useSessionStore } from '@/features/session';
9+
import { useSocket } from '@/features/socket';
910
import { useToastStore } from '@/features/toast';
1011

1112
import {
@@ -29,6 +30,8 @@ function QuestionList() {
2930
setSelectedQuestionId,
3031
} = useSessionStore();
3132

33+
const socket = useSocket();
34+
3235
const { addToast } = useToastStore();
3336

3437
const { Modal: CreateQuestion, openModal: openCreateQuestionModal } =
@@ -48,6 +51,7 @@ function QuestionList() {
4851
postSessionTerminate({ sessionId, token: sessionToken })
4952
.then((response) => {
5053
if (response.expired) {
54+
socket?.disconnect();
5155
setExpired(true);
5256
addToast({
5357
type: 'SUCCESS',

0 commit comments

Comments
 (0)