diff --git a/src/pages/Buyer/BuyerLogout.tsx b/src/pages/Buyer/BuyerLogout.tsx index 7d605d1c..f82de29c 100644 --- a/src/pages/Buyer/BuyerLogout.tsx +++ b/src/pages/Buyer/BuyerLogout.tsx @@ -1,6 +1,7 @@ import { patchAuthSignOut } from 'api/patch'; import { BackIcon, HeaderWrapper } from 'components/Buyer/Common/Header'; import { Button } from 'components/Common/Button'; +import { useStompContext } from 'contexts/StompContext'; import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { Green, Grey1, LightGreen } from 'styles/color'; @@ -10,6 +11,8 @@ import { Characters } from 'utils/Characters'; export const BuyerLogout = () => { const navigate = useNavigate(); + const { stompClient } = useStompContext(); + const patchSingOut = async ( accessTokenValue: string | null, refreshTokenValue: string | null, @@ -26,6 +29,7 @@ export const BuyerLogout = () => { await patchAuthSignOut(body); localStorage.removeItem('accessToken'); localStorage.removeItem('refreshToken'); + stompClient.current?.disconnect(); navigate('/mypage'); } catch (e) { console.log(e); diff --git a/src/pages/Seller/SellerLogout.tsx b/src/pages/Seller/SellerLogout.tsx index 1334d433..956b4d1e 100644 --- a/src/pages/Seller/SellerLogout.tsx +++ b/src/pages/Seller/SellerLogout.tsx @@ -1,6 +1,7 @@ import { patchAuthSignOut } from 'api/patch'; import { BackIcon, HeaderWrapper } from 'components/Buyer/Common/Header'; import { Button } from 'components/Common/Button'; +import { useStompContext } from 'contexts/StompContext'; import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { Green, Grey1, LightGreen } from 'styles/color'; @@ -10,6 +11,8 @@ import { Characters } from 'utils/Characters'; export const SellerLogout = () => { const navigate = useNavigate(); + const { stompClient } = useStompContext(); + const patchSingOut = async ( accessTokenValue: string | null, refreshTokenValue: string | null, @@ -26,6 +29,7 @@ export const SellerLogout = () => { await patchAuthSignOut(body); localStorage.removeItem('accessToken'); localStorage.removeItem('refreshToken'); + stompClient.current?.disconnect(); navigate('/mypage'); } catch (e) { console.log(e);