diff --git a/src/common/components/appbar/ArrowLeft.tsx b/src/common/components/appbar/ArrowLeft.tsx index f3789f1d..c8df91ed 100644 --- a/src/common/components/appbar/ArrowLeft.tsx +++ b/src/common/components/appbar/ArrowLeft.tsx @@ -2,10 +2,10 @@ import CaretLeftIcon from '@/common/assets/icon/icon-arrow-back.svg'; import { Button } from './CommonStyle'; import { useNavigate } from 'react-router-dom'; -const ArrowLeft = () => { +const ArrowLeft = ({ locate = -1 }: { locate?: string | number }) => { const navigate = useNavigate(); const onClick = () => { - navigate(-1); + history.length <= 2 ? navigate('/', { replace: true }) : navigate(locate as string); }; return ( diff --git a/src/pages/my/edit/index.tsx b/src/pages/my/edit/index.tsx index 8de1a5f4..60952183 100644 --- a/src/pages/my/edit/index.tsx +++ b/src/pages/my/edit/index.tsx @@ -41,7 +41,7 @@ const ProfileEdit = () => { mutate({ nickname: nickname, profileImg: file }); }; - if (isProfileEditSuccess) navigate('/profile'); + if (isProfileEditSuccess) navigate('/profile', { replace: true }); if (isProfileLoading || isProfileEditLoading) return ; if (isProfileError) { const errorMessage = profileError?.message || '프로필 데이터를 가져오는 중 문제가 발생했습니다.'; diff --git a/src/pages/search/index/components/Search.tsx b/src/pages/search/index/components/Search.tsx index a6409a0f..6584c12c 100644 --- a/src/pages/search/index/components/Search.tsx +++ b/src/pages/search/index/components/Search.tsx @@ -40,7 +40,7 @@ const Search = () => { }; const Wrapper = styled.div` - width: fit-content; + width: 100%; height: fit-content; margin: 0 auto; `;