Skip to content

Commit

Permalink
fix: navigate path 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhokim98 committed Jul 24, 2024
1 parent 0548366 commit fefabfb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions HDesign/src/components/TopNav/TopNav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsxImportSource @emotion/react */
import {useNavigate} from 'react-router-dom';
import {useLocation, useNavigate} from 'react-router-dom';
import TextButton from '../TextButton/TextButton';
import {topNavNonStyle, topNavStyle} from './TopNav.style';
import {TopNavProps} from './TopNav.type';
Expand All @@ -11,10 +11,13 @@ import {useState} from 'react';
const TopNav = ({navType}: TopNavProps) => {
const [nav, setNav] = useState('홈');
const navigate = useNavigate();
const location = useLocation();

const basePath = location.pathname.split('/').slice(0, -1).join('/');

const PATH_TABLE: Record<string, string> = {
: '.',
관리: './admin',
: `${basePath}/home`,
관리: `${basePath}/admin`,
};

const handleRoute = (nav: string) => {
Expand Down

0 comments on commit fefabfb

Please sign in to comment.