Skip to content

Commit

Permalink
fix: nav바 role 받아오는 로직 getRole 함수로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
se0jinYoon committed Oct 21, 2024
1 parent 7d0598d commit 20d69e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/commons/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ import styled from '@emotion/styled';
import { useState, useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { NaviLookBlackIc, NaviPromiseBlackIc, NaviMyBlackIc } from '../../assets/svgs';
import { getRole } from '@utils/storage';

const Nav = () => {
const navigate = useNavigate();
const location = useLocation();

const userRole = localStorage.getItem('role') + '';
const userRole = getRole();
const [currNav, setCurrNav] = useState(location.pathname);

useEffect(() => {
if (currNav !== location.pathname) {
navigate(currNav);
}
}, [currNav, navigate, location.pathname]);
}, [currNav, location.pathname]);

// 유저가 선배일 경우 접근 가능한 곳 : 나의 약속
// 유저가 후배일 경우 접근 가능한 곳 : 둘러보기, 나의 약속
Expand Down

0 comments on commit 20d69e2

Please sign in to comment.