diff --git a/src/apis/hooks/useSignUp.ts b/src/apis/hooks/useSignUp.ts index 3750fc9c..56a19fbe 100644 --- a/src/apis/hooks/useSignUp.ts +++ b/src/apis/hooks/useSignUp.ts @@ -7,19 +7,13 @@ interface User { password: string } -interface SignUpSuccess { +interface SignUp { success: boolean } -interface SignUpFail { - status: string - errorCode: string - message: string -} - const useSignUp = () => { const signUp = async (user: User) => { - return await apiClient.post('/sign-up', user) + return await apiClient.post('/sign-up', user) } return useMutation({ mutationFn: signUp }) diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 085e7139..08ce969f 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -1,6 +1,6 @@ -import { memo } from 'react' +import { memo, useRef, useState } from 'react' import { useLocation, useNavigate } from 'react-router-dom' -import { useDarkMode, useToast, useCheckHeaderRoute } from '@/hooks' +import { useDarkMode, useToast } from '@/hooks' import { useUser, useLogout } from '@/apis/hooks' import { LogoRowIcon, @@ -27,6 +27,10 @@ const Header = memo(({ handleGoBack }: HeaderProps) => { const { addToast } = useToast() const { toggle, darkMode } = useDarkMode() + const [toPath, setToPath] = useState('') + + const labelRef = useRef(null) + const avatarVisible = pathname !== '/sign-up' && pathname !== '/login' const goBackVisible = pathname !== '/login' && pathname !== '/' @@ -38,39 +42,41 @@ const Header = memo(({ handleGoBack }: HeaderProps) => { }, }) } - const { myPageButtonClicked, logoButtonClicked } = useCheckHeaderRoute() + + const handleNavigate = (path: string | number) => { + if ( + pathname.includes('review-response') || + pathname.includes('review-creation') + ) { + setToPath(path) + labelRef.current?.click() + + return + } + + navigate(path as string) + } return (
-
- +
handleNavigate(-1))} + > +
{ - if (!logoButtonClicked) { - navigate('/') - } - }} + onClick={() => handleNavigate('/')} > - + ranger-header + +
{

{user.name}

- - + handleNavigate('/profile')}> + 마이페이지 @@ -138,21 +134,13 @@ const Header = memo(({ handleGoBack }: HeaderProps) => { handleClickLabel={handleLogout} /> +