Skip to content

Commit

Permalink
#321 feat: type 쿼리로 initialTab 결정하는 거 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YelynnOh committed Apr 10, 2024
1 parent 927cd4d commit ee75cbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/follow/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { usePathname } from 'next/navigation';
import { usePathname, useSearchParams } from 'next/navigation';

import FollowerList from '@components/following/FollowerList';
import Tab from '@components/mypage/Tab';
Expand All @@ -9,13 +9,16 @@ import { useGetFollowingList } from '@hooks/api/useGetFollowingList';
export default function Page() {
const pathname = usePathname();
const userId = Number(pathname.split('/').pop());
const searchParams = useSearchParams();

const type = searchParams.get('type');

const { data: followerList } = useGetFollowingList(userId, 'FOLLOWER');
const { data: followingList } = useGetFollowingList(userId, 'FOLLOWER');

return (
<div>
<Tab.Group initialTab="follower">
<Tab.Group initialTab={type ? type : 'follower'}>
<div className="h-[76px] w-full flex sticky top-[40px] bg-white z-above rounded-t-[24px]">
<Tab.Header>
<Tab.Item value="follower" className="w-[1/2] my-[10px]">
Expand Down

0 comments on commit ee75cbb

Please sign in to comment.