Skip to content

Commit

Permalink
✨ Feat : 헤더에서 로그인 한 유저만 알림 아이콘 보이도록 처리, 로그인한 유저 사용자/사업자 구분하고 알림 페이지로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
JOEIH committed Dec 6, 2024
1 parent 817124f commit 576acf6
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/components/LogoAndNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import Logo from '@assets/images/roomit_logo.png';
import useAuthStore from '@store/authStore';
import { getRole } from '@utils/auth';
import { RiNotification3Line } from 'react-icons/ri';
import { Link } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';

const LogoAndNotification = () => {
const navigate = useNavigate();
const { isLogin } = useAuthStore();
const role = getRole();

const handleMoveToNotiPageClick = () => {
if (role === 'ROLE_USER') {
navigate('/user-noti');
} else {
navigate('/host-noti');
}
};

return (
<>
<Link to='/'>
Expand All @@ -12,7 +26,12 @@ const LogoAndNotification = () => {
alt='ROOM:IT 로고'
/>
</Link>
<RiNotification3Line className='h-[24px] w-[24px]' />
{isLogin && (
<RiNotification3Line
className='h-[24px] w-[24px] cursor-pointer'
onClick={handleMoveToNotiPageClick}
/>
)}
</>
);
};
Expand Down

0 comments on commit 576acf6

Please sign in to comment.