Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/api/endpoint/members/postWorkPreference.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { z } from 'zod';

import { createEndpoint } from '@/api/typedAxios';
Expand All @@ -14,7 +14,12 @@ export const postWorkPreference = createEndpoint({
});

export const usePostWorkPreferenceMutation = () => {
const queryClient = useQueryClient();

return useMutation({
mutationFn: (requestBody: WorkPreferenceType) => postWorkPreference.request(requestBody),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['getRecommendations'] });
},
});
};
34 changes: 22 additions & 12 deletions src/components/matchmember/MatchContent.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { useRouter } from 'next/router';
import Text from '@/components/common/Text';
import styled from '@emotion/styled';
import { colors } from '@sopt-makers/colors';
import { Spacing } from '@toss/emotion-utils';
import promotion from '@/public/icons/img/popup/member_match.png';
import { Button } from '@sopt-makers/ui';
import styled from '@emotion/styled';
import { MemberCard } from '@/components/matchmember/MemberCard';
import { playgroundLink } from '@/constants/links';
import { Spacing } from '@toss/emotion-utils';
import { useRouter } from 'next/router';

import { usePostWorkPreferenceMutation } from '@/api/endpoint/members/postWorkPreference';
import Loading from '@/components/common/Loading';
import Text from '@/components/common/Text';
import { LoggingClick } from '@/components/eventLogger/components/LoggingClick';
import useEventLogger from '@/components/eventLogger/hooks/useEventLogger';
import {
BalanceGameValue,
ChoiceSide,
convertAnswersToApiPayload,
QuestionKey,
QUESTIONS,
} from '@/components/matchmember/constant';
import { usePostWorkPreferenceMutation } from '@/api/endpoint/members/postWorkPreference';
import Loading from '@/components/common/Loading';
import { LoggingClick } from '@/components/eventLogger/components/LoggingClick';
import useEventLogger from '@/components/eventLogger/hooks/useEventLogger';
import { MemberCard } from '@/components/matchmember/MemberCard';
import { playgroundLink } from '@/constants/links';
import promotion from '@/public/icons/img/popup/member_match.png';

interface MatchContentProps {
step: number;
Expand Down Expand Up @@ -124,6 +125,15 @@ export const MatchContent = ({
</>
);
}

const handleNavigateToMemberList = () => {
if (router.pathname === playgroundLink.memberList()) {
handleClose();
} else {
router.push(playgroundLink.memberList());
}
};

return (
<>
<Text typography='SUIT_20_B' color={colors.gray10}>
Expand All @@ -136,7 +146,7 @@ export const MatchContent = ({
<MemberCard />
<Spacing size={24} />
<LoggingClick eventKey='newmember'>
<Button size='lg' onClick={() => router.push(playgroundLink.memberList())}>
<Button size='lg' onClick={handleNavigateToMemberList}>
다른 찰떡 멤버도 확인하기
</Button>
</LoggingClick>
Expand Down
Loading