Skip to content

Commit deefde9

Browse files
committed
[chore]머지후 커밋
1 parent a629822 commit deefde9

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

src/domains/mypage/components/pages/my-active/MyLike.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ function MyLike() {
2020
fetchLike();
2121
}, []);
2222

23-
return (
24-
<PostCard posts={myLike} isLoading={isLoading} />
25-
);
23+
return <PostCard posts={myLike} isLoading={isLoading} />;
2624
}
2725
export default MyLike;

src/shared/components/header/HeaderBtn.tsx

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,43 @@ import { useRouter } from 'next/navigation';
66
import tw from '@/shared/utills/tw';
77
import { useAuthStore } from '@/domains/shared/store/auth';
88
import { setPreLoginPath } from '@/domains/shared/auth/utils/setPreLoginPath';
9-
import { useEffect, useState } from 'react';
9+
import { useEffect, useState } from 'react';
1010
import LogoutConfirm from '@/domains/login/components/LogoutConfirm';
1111
import { getApi } from '@/app/api/config/appConfig';
1212

13-
1413
function HeaderBtn({ pathname }: { pathname: string }) {
1514
const { isLoggedIn } = useAuthStore();
1615
const router = useRouter();
1716
const [logoutModalOpen, setLogoutModalOpen] = useState(false);
18-
const [hasNewNotification,setHasNotification] = useState(false)
17+
const [hasNewNotification, setHasNotification] = useState(false);
18+
19+
useEffect(() => {
20+
if (!isLoggedIn) return;
1921

20-
useEffect(() => {
21-
if (!isLoggedIn) return;
22+
console.log('🔌 SSE 연결 시작...');
23+
const eventSource = new EventSource(`${getApi}/me/subscribe`, { withCredentials: true });
2224

23-
console.log('🔌 SSE 연결 시작...');
24-
const eventSource = new EventSource(`${getApi}/me/subscribe`, { withCredentials: true });
25+
eventSource.onopen = () => {
26+
console.log('✅ SSE 연결 성공!');
27+
};
2528

26-
eventSource.onopen = () => {
27-
console.log('✅ SSE 연결 성공!');
28-
};
29+
eventSource.onmessage = (event) => {
30+
console.log('📢 새 알림 도착:', event.data);
31+
setHasNotification(true);
32+
};
2933

30-
eventSource.onmessage = (event) => {
31-
console.log('📢 새 알림 도착:', event.data);
32-
setHasNotification(true);
33-
};
34+
eventSource.onerror = (error) => {
35+
console.error('❌ SSE 에러:', error);
36+
console.log('연결 상태:', eventSource.readyState); // 0: CONNECTING, 1: OPEN, 2: CLOSED
37+
eventSource.close();
38+
};
3439

35-
eventSource.onerror = (error) => {
36-
console.error('❌ SSE 에러:', error);
37-
console.log('연결 상태:', eventSource.readyState); // 0: CONNECTING, 1: OPEN, 2: CLOSED
38-
eventSource.close();
39-
};
40+
return () => {
41+
console.log('🔌 SSE 연결 종료');
42+
eventSource.close();
43+
};
44+
}, [isLoggedIn]);
4045

41-
return () => {
42-
console.log('🔌 SSE 연결 종료');
43-
eventSource.close();
44-
};
45-
}, [isLoggedIn]);
46-
4746
useEffect(() => {
4847
const timer = setTimeout(() => {
4948
console.log('🧪 테스트 알림 발생');
@@ -60,20 +59,19 @@ function HeaderBtn({ pathname }: { pathname: string }) {
6059
className: pathname === '/mypage/my-alarm' ? 'text-tertiary' : 'text-current',
6160
hiddenMobile: true,
6261
onClick: () => {
63-
setHasNotification(false)
64-
router.push('/mypage/my-alarm')
62+
setHasNotification(false);
63+
router.push('/mypage/my-alarm');
6564
},
66-
showBadge:true
65+
showBadge: true,
6766
},
6867
{
6968
icon: User,
7069
label: '마이 페이지',
7170
className: pathname === '/mypage' ? 'text-tertiary' : 'text-current',
7271
hiddenMobile: true,
7372
onClick: () => router.push('/mypage'),
74-
showBadge:false
73+
showBadge: false,
7574
},
76-
7775
];
7876

7977
const authButton = isLoggedIn

src/shared/components/header/NavItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ interface Props {
88
}
99

1010
function NavItem({ pathname, className }: Props) {
11-
1211
return (
1312
<nav className={tw(className)}>
1413
<ul className="text-white flex gap-[24px] font-serif font-normal text-base md:text-lg">

0 commit comments

Comments
 (0)