SubNav.js 968 Bytes
Newer Older
한규민's avatar
한규민 committed
1
2
import { Link } from "react-router-dom";
import { useAuth } from "../../context/auth_context.js"
Kim, Subin's avatar
Kim, Subin committed
3

Jiwon Yoon's avatar
Jiwon Yoon committed
4
const SubNav = () => {
한규민's avatar
한규민 committed
5
    const { user, logout } = useAuth();
한규민's avatar
context    
한규민 committed
6

한규민's avatar
한규민 committed
7
    return (
Kim, Subin's avatar
Kim, Subin committed
8
9
        <nav className="nav justify-content-end py-1">
            {(user.id === 0) ? <>
한규민's avatar
한규민 committed
10
11
                <Link className="nav-link text-white" to="/login">로그인</Link>
                <Link className="nav-link text-white" to="/signup" >회원가입</Link>
Kim, Subin's avatar
Kim, Subin committed
12
13
14
15
16
17
18
19
            </> : <>{(user.role === "admin") ?
                <Link className="nav-link text-white" to="/admin">관리자페이지</Link>
                : ((user.role === "member") ?
                    <Link className="nav-link text-white" to="/mypage">마이페이지</Link>
                    : <Link className="nav-link text-white" to="/guest">예매확인</Link>)}
                <Link className="nav-link text-white" to="/" onClick={logout}>로그아웃</Link>
            </>}
        </nav>
한규민's avatar
한규민 committed
20
    )
Jiwon Yoon's avatar
Jiwon Yoon committed
21
}
Kim, Subin's avatar
Kim, Subin committed
22

Jiwon Yoon's avatar
Jiwon Yoon committed
23
export default SubNav