@@ -2,7 +2,11 @@ import styled from '@emotion/styled';
22import { useNavigate } from 'react-router-dom' ;
33import { Icon , Text , FixedContainer } from 'components' ;
44import theme from 'styles/theme' ;
5- import { memo } from 'react' ;
5+ import { memo , useEffect } from 'react' ;
6+ import Badge from 'components/basic/Badge' ;
7+ import useLocalToken from 'hooks/useLocalToken' ;
8+ import { useState } from 'react' ;
9+ import { getNotifications } from 'utils/apis/userApi' ;
610
711const { headerHeight, pagePadding } = theme . value ;
812const { borderLight } = theme . color ;
@@ -39,10 +43,16 @@ const InnerRight = styled.div`
3943
4044export const Header = ( { prev, title, info, complete, onComplete } ) => {
4145 const navigate = useNavigate ( ) ;
42-
4346 const onClickPrev = ( ) => {
4447 navigate ( - 1 ) ;
4548 } ;
49+ const [ isSeen , setIsSeen ] = useState ( true ) ;
50+ const [ token ] = useLocalToken ( ) ;
51+ const initNotifications = async ( ) => {
52+ const fetchedNotifications = await getNotifications ( token ) ;
53+ setIsSeen ( fetchedNotifications . data [ 0 ] . seen ) ;
54+ } ;
55+ initNotifications ( ) ;
4656
4757 return (
4858 < HeaderContainer top height = { headerHeight } >
@@ -53,7 +63,9 @@ export const Header = ({ prev, title, info, complete, onComplete }) => {
5363 < InnerRight >
5464 { info && (
5565 < >
56- < Icon . Link to = "/user/notification" name = "NOTIFICATION" size = { 30 } />
66+ < Badge dot = { isSeen } >
67+ < Icon . Link to = "/user/notification" name = "NOTIFICATION" size = { 30 } />
68+ </ Badge >
5769 < Icon . Link to = "/user/myinfo" name = "MY_INFO" size = { 30 } />
5870 </ >
5971 ) }
0 commit comments