Skip to content

Commit

Permalink
fix: API 문서 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene028 committed Jul 31, 2024
1 parent b79bfcd commit fa39bf2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 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.patch(
`/onboarding/verify-email?token=${token}`
);
const response = await apiClient.patch(`/onboarding/verify-email`, {
token: token
});
return response.data;
}
};
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';
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

0 comments on commit fa39bf2

Please sign in to comment.