Skip to content

Commit

Permalink
feat :: 코멘트 반영
Browse files Browse the repository at this point in the history
indexOf 대신 startWith매서드 사용
  • Loading branch information
KANGYONGSU23 committed Dec 15, 2023
1 parent 7805811 commit b09ad68
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@ function Header() {
const pathname = usePathname();
const { userProfile, setUserProfile } = useContext(UserProfileContext);
const [cookies] = useCookies();
console.log(pathname);

useEffect(() => {
if (
pathname.toString().indexOf("/apply") !== -1 ||
pathname.toString().indexOf("/account") !== -1
pathname.toString().startsWith("/apply", 13) ||
pathname.toString().startsWith("/account")
) {
document.querySelector("body")!.style.backgroundColor = "#fafafa";
} else {
document.querySelector("body")!.style.backgroundColor = "#ffffff";
}
}, [pathname]);

useEffect(() => {
if(cookies.access_token){
if (cookies.access_token) {
useMyProfile(setUserProfile);
}
}, [cookies.access_token]);

if (pathname.toString().indexOf("/account") !== -1) {
if (pathname.toString().startsWith("/account")) {
return null;
}

Expand Down

0 comments on commit b09ad68

Please sign in to comment.