Skip to content

Commit

Permalink
[#39] Fix: nav 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
DHyeon98 committed Jun 21, 2024
1 parent 631285c commit 576e476
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions api/my/groups/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ export default class MyFamilyApi {
}

async myFamilyDelete() {
return axiosInstance.delete(`/my/groups`);
return await axiosInstance.delete(`/my/groups`);
}

async myFamilyModify(formData: NameModifyType) {
return axiosInstance.put(`/my/groups`, formData);
return await axiosInstance.put(`/my/groups`, formData);
}

async myFamilyAddMember(formData: FieldValues) {
return axiosInstance.post(`/my/groups/members`, formData);
return await axiosInstance.post(`/my/groups/members`, formData);
}

async myFamilyDeleteMember(targetId: number) {
return axiosInstance.post(`/my/groups/members/${targetId}`);
return await axiosInstance.post(`/my/groups/members/${targetId}`);
}
}
3 changes: 2 additions & 1 deletion components/common/nav/nav-list/nav-list-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { NavListProps } from '../types/nav';

export default function NavListItem({ href, text, RenderSvgComponent }: NavListProps) {
const { pathname } = useRouter();
console.log(pathname, href);
return (
<li className={pathname.includes(href) ? `${styles.on} ${styles.navList}` : styles.navList}>
<li className={pathname === href ? `${styles.on} ${styles.navList}` : styles.navList}>
<Link href={href}>
<div className={styles.imgBox} aria-label={text}>
<RenderSvgComponent />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function DeleteModal({ Modal, handleModal }: DeleteModalType) {
await myFamilyApi.myFamilyDelete();
deleteCookie('accessToken');
deleteCookie('refreshToken');
router.push('/login');
router.push('/');
} catch {
console.log('에러');
}
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 10 additions & 2 deletions utils/is-nav.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { NextRouter } from 'next/router';

export const isNav = (router: NextRouter) => {
const navPaths = ['/calendar', '/family', '/diaries', '/growth', '/story'];
console.log(navPaths.some((path) => router.pathname === path));
const navPaths = [
'/calendar',
'/family',
'/diaries',
'/growth',
'/story',
'/mypage',
'/mypage/pet',
'/mypage/family-management',
];
return navPaths.some((path) => router.pathname === path);
};

0 comments on commit 576e476

Please sign in to comment.