Skip to content

Commit

Permalink
[Fix]: 디스코드 연동 마이너 이슈 수정 (#75)
Browse files Browse the repository at this point in the history
* fix: 디스코드 합류 체크 관련 API 호출 개선 및 문구 변경

* fix: 메서드 잘못된거 하나 슬쩍 고치기

* fix: API 문서 수정
  • Loading branch information
eugene028 authored Jul 31, 2024
1 parent fa091b5 commit 295840a
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/apis/auth/verifyStudentApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const verifyStudentApi = {
return response.data;
},
VERIFY_STUDENT_EMAIL: async (token: string) => {
const response = await apiClient.get(
`/onboarding/verify-email?token=${token}`
);
const response = await apiClient.patch(`/onboarding/verify-email`, {
token: token
});
return response.data;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/discordConnect/DiscordName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const DiscordName = ({ onNext }: { onNext: () => void }) => {
setError('discordUsername', {
type: 'manual',
message:
'이미 가입된 사용자명이에요. 이전에 가입한 적이 있으신 경우, 채널톡으로 문의해주세요.'
'이미 가입된 사용자명이에요. 이전에 가입한 적이 있으신 경우, 카카오톡 채널로 문의해주세요.'
});
} else {
onNext();
Expand Down
2 changes: 1 addition & 1 deletion src/components/discordConnect/DiscordNickName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const TextSection = memo(() => (
<Image src={DiscordImage} alt="discord-nickname" width={325} height={157} />
<Text typo="body1">
가입이 완료되면 가입 신청서에 제출하신 별명으로 자동으로 수정될 거예요.
추후 별명을 수정하고 싶다면 채널톡으로 코어멤버에게 연락 주세요.
추후 별명을 수정하고 싶다면 카카오톡 채널로 코어멤버에게 연락 주세요.
</Text>
</>
));
Expand Down
4 changes: 3 additions & 1 deletion src/components/discordConnect/JoinServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { css } from '@emotion/react';
import { useFormContext } from 'react-hook-form';
import useGetDiscordJoined from '@/hooks/query/useGetDiscordJoined';
import { DiscordFormValues } from '@/types/discord';
import RoutePath from '@/routes/routePath';

export const JoinServer = ({ onNext }: { onNext: () => void }) => {
const { getValues } = useFormContext<DiscordFormValues>();
Expand All @@ -28,6 +29,7 @@ export const JoinServer = ({ onNext }: { onNext: () => void }) => {
<TextButton
text=" GDSC Hongik 공식 디스코드 서버↗︎"
style={{ color: color.discord }}
onClick={() => window.open(RoutePath.GDSCHongikDiscord, '_blank')}
/>

<Button
Expand All @@ -46,7 +48,7 @@ export const JoinServer = ({ onNext }: { onNext: () => void }) => {
text-align: center;
`}>
합류가 확인되지 않을 경우 <br />
채널톡을 통해 코어멤버에게 문의해주세요!
카카오톡 채널을 통해 코어멤버에게 문의해주세요!
</Text>
</Flex>
</>
Expand Down
1 change: 1 addition & 0 deletions src/hooks/mutation/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as useSendStudentEmail } from './useSendStudentEmail';
export { default as useVerifyStudentEmail } from './useVerifyStudentEmail';
14 changes: 14 additions & 0 deletions src/hooks/mutation/useVerifyStudentEmail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { verifyStudentApi } from '@/apis/auth';
import { useMutation } from '@tanstack/react-query';

export default function useVerifyStudentEmail() {
const {
mutate: verifyStudentMail,
isSuccess,
isPending
} = useMutation({
mutationFn: verifyStudentApi.VERIFY_STUDENT_EMAIL
});

return { verifyStudentMail, isSuccess, isPending };
}
1 change: 0 additions & 1 deletion src/hooks/query/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as useGetDepartmentList } from './useGetDepartmentList';
export { default as useVerifyStudentEmail } from './useVerifyStudentEmail';
export { default as useVerifyStudent } from './useVerifyStudent';
3 changes: 2 additions & 1 deletion src/hooks/query/useGetDiscordJoined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useQuery } from '@tanstack/react-query';
export default function useGetDiscordJoined(username: string) {
const query = useQuery({
queryKey: [QueryKeys.DiscordJoined],
queryFn: () => discordApi.GET_DISCORD_JOIN(username)
queryFn: () => discordApi.GET_DISCORD_JOIN(username),
refetchOnWindowFocus: true
});

return query;
Expand Down
18 changes: 0 additions & 18 deletions src/hooks/query/useVerifyStudentEmail.ts

This file was deleted.

10 changes: 8 additions & 2 deletions src/pages/redirect/StudentVerificationServerRedirect.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text, Flex } from '@/components/common/Wrapper';
import { useVerifyStudentEmail } from '@/hooks/query';
import { useVerifyStudentEmail } from '@/hooks/mutation';
import { color } from 'wowds-tokens';
import Button from 'wowds-ui/Button';
import GlobalSize from '@/constants/globalSize';
Expand All @@ -9,12 +9,18 @@ import { css } from '@emotion/react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { PulseLoader } from 'react-spinners';
import RoutePath from '@/routes/routePath';
import { useLayoutEffect } from 'react';

export const StudentVerificationServerRedirect = () => {
const [searchParams] = useSearchParams();
const navigate = useNavigate();
const token = searchParams.get('token');
const { isSuccess, isPending } = useVerifyStudentEmail(token);
const { isSuccess, isPending, verifyStudentMail } = useVerifyStudentEmail();

useLayoutEffect(() => {
if (token) verifyStudentMail(token);
}, [token, verifyStudentMail]);
console.log(isSuccess);

//TODO: 추후 로딩 스피너 추가 필요
return (
Expand Down
1 change: 1 addition & 0 deletions src/routes/routePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const RoutePath = {
AuthServerRedirect: '/social-login/redirect',
StudentVerificationServerRedirect: '/onboarding/verify-email',
GDSCHongikLink: 'https://www.gdschongik.com',
GDSCHongikDiscord: 'https://discord.gg/dSV6vSEuGU',
GitHubGuideLink: 'https://www.gdschongik.com/guide/github',
StudentEmailLinkGuideLink: 'https://www.gdschongik.com/guide/student-email',
CommunityGuideLink:
Expand Down

0 comments on commit 295840a

Please sign in to comment.