Skip to content

Commit

Permalink
Merge pull request #134 from IT-Cotato/fix/COT-7_resolve_mypage_issues
Browse files Browse the repository at this point in the history
chore: add state variables
  • Loading branch information
Ea-st-ring authored Oct 6, 2024
2 parents 62685b7 + 2eea40a commit b3e6527
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/pages/MyPage/CSRecord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ const medalImgSrcs = [
const CSRecord = () => {
const { user } = useUser();
const [params] = useSearchParams();
const generationId = params.get('generationId') ?? '0';
const generationId = params.get('generationId');

const { targetGeneration } = useGeneration({ generationId });
const [selectedGenerationId, setSelectedGenerationId] = React.useState<string | undefined>(
generationId || undefined,
);

const { targetGeneration } = useGeneration({ generationId: selectedGenerationId });

const { data: hallOfFameData } = useSWR(
'/v1/api/mypage/hall-of-fame?generationId=' + targetGeneration?.generationId,
Expand All @@ -44,7 +48,11 @@ const CSRecord = () => {
<Wrapper>
<Title>내가 풀어본 CS 문제풀이</Title>
<SelectGenerationDiv>
<GenerationDropBox handleGenerationChange={() => {}} />
<GenerationDropBox
handleGenerationChange={(generation) => {
setSelectedGenerationId(generation?.generationId?.toString());
}}
/>
{/* </select> */}
</SelectGenerationDiv>
<MyInfoBox>
Expand Down

0 comments on commit b3e6527

Please sign in to comment.