Skip to content

Commit 32345f7

Browse files
fix: 임시 로그인 제거
1 parent a3d6bf2 commit 32345f7

File tree

1 file changed

+3
-45
lines changed
  • src/shared/component/Layout/layoutHeader

1 file changed

+3
-45
lines changed
Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import { useState, useEffect } from 'react';
1+
import { useState } from 'react';
22
import { useNavigate, useLocation, Link } from 'react-router-dom';
33

44
import * as styles from './Header.css';
55

66
import { PATH } from '@/route/path';
77
import IcLogo from '@/assets/svg/IcLogo';
8-
import LoginModal from '@/common/component/LoginModal/LoginModal';
9-
import UserModal from '@/common/component/UserModal/UserModal';
10-
import { useModal } from '@/common/hook/useModal';
11-
import { useGetUser } from '@/api/domain/signup/hook/useGetUser';
128

139
const MENUS = [
1410
{ label: '나의 할 일', path: PATH.TODO },
@@ -19,35 +15,17 @@ const MENUS = [
1915
const Header = () => {
2016
const navigate = useNavigate();
2117
const location = useLocation();
22-
const accessToken = localStorage.getItem('accessToken');
2318

2419
const findActiveMenu = MENUS.find((menu) => location.pathname.startsWith(menu.path));
2520
const initialMenu = findActiveMenu ? findActiveMenu.label : '';
26-
const [activeMenu, setActiveMenu] = useState<string>(initialMenu);
27-
28-
const [openProfile, setOpenProfile] = useState<boolean>(false);
29-
const { openModal, closeModal, ModalWrapper } = useModal();
30-
31-
const [isLoggedIn, setIsLoggedIn] = useState<boolean>(!!accessToken);
32-
const { data: user, isLoading } = useGetUser();
3321

34-
useEffect(() => {
35-
setIsLoggedIn(!!localStorage.getItem('accessToken'));
36-
}, []);
37-
38-
const handleLogin = () => {
39-
openModal(<LoginModal onClose={closeModal} />);
40-
};
22+
const [activeMenu, setActiveMenu] = useState<string>(initialMenu);
4123

4224
const handleMenuClick = (menuLabel: string, path: string) => {
4325
setActiveMenu(menuLabel);
4426
navigate(path);
4527
};
4628

47-
const handleProfile = () => {
48-
setOpenProfile((prev) => !prev);
49-
};
50-
5129
const renderNavMenu = () => (
5230
<>
5331
<nav className={styles.navWrapper}>
@@ -67,18 +45,6 @@ const Header = () => {
6745
);
6846
})}
6947
</nav>
70-
71-
{!isLoading && user && (
72-
<>
73-
<img
74-
src={user.profileImageUrl}
75-
alt="유저 프로필"
76-
className={styles.profilePlaceholder}
77-
onClick={handleProfile}
78-
/>
79-
{openProfile && <UserModal onClose={handleProfile} />}
80-
</>
81-
)}
8248
</>
8349
);
8450

@@ -89,17 +55,9 @@ const Header = () => {
8955
<IcLogo className={styles.logoImage} />
9056
</Link>
9157

92-
{isLoggedIn ? (
93-
renderNavMenu()
94-
) : (
95-
<button className={styles.loginButton} onClick={handleLogin}>
96-
로그인
97-
</button>
98-
)}
58+
{renderNavMenu()}
9959
</div>
100-
{ModalWrapper}
10160
</header>
10261
);
10362
};
104-
10563
export default Header;

0 commit comments

Comments
 (0)