File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 11import { Route , Routes } from 'react-router' ;
22
3+ import { useServerSentEvents } from './hooks/useServerSentEvents' ;
34import useViewport from './hooks/useViewport' ;
45import Layout from './layouts/Layout' ;
56import MobileLayout from './layouts/MobileLayout' ;
@@ -27,6 +28,7 @@ import WritePage from './pages/Write';
2728
2829const App = ( ) => {
2930 useViewport ( ) ;
31+ useServerSentEvents ( ) ;
3032
3133 return (
3234 < Routes >
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ export const useServerSentEvents = () => {
3030 console . log ( '알림 전송' ) ;
3131 } ;
3232
33- // sourceRef.current.addEventListener('notification', (event) => {
34- // console.log(event);
35- // console.log('알림 전송 dd');
36- // });
33+ sourceRef . current . addEventListener ( 'notification' , ( event ) => {
34+ console . log ( event ) ;
35+ console . log ( '알림 전송 dd' ) ;
36+ } ) ;
3737
3838 sourceRef . current . onerror = ( error ) => {
3939 console . log ( error ) ;
Original file line number Diff line number Diff line change @@ -3,14 +3,11 @@ import { useNavigate } from 'react-router';
33
44import { getTimeLines , patchReadNotification , patchReadNotificationAll } from '@/apis/notification' ;
55import PageTitle from '@/components/PageTitle' ;
6- import { useServerSentEvents } from '@/hooks/useServerSentEvents' ;
76
87import NotificationItem from './components/NotificationItem' ;
98import WarningModal from './components/WarningModal' ;
109
1110const NotificationsPage = ( ) => {
12- useServerSentEvents ( ) ;
13-
1411 const navigate = useNavigate ( ) ;
1512
1613 const [ noti , setNoti ] = useState < Noti [ ] > ( [ ] ) ;
@@ -19,6 +16,7 @@ const NotificationsPage = () => {
1916
2017 const [ adminText , setAdmintext ] = useState < string > ( '' ) ;
2118
19+ // MEMO : 편지 데이터 전송중 데이터도 추가될건데 나중에 데이터 추가되면 코드 업데이트 하긔
2220 const handleClickItem = ( alarmType : string , content ?: string | number ) => {
2321 if ( alarmType === 'LETTER' ) {
2422 navigate ( `/letter/${ content } ` ) ;
You can’t perform that action at this time.
0 commit comments