-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix]: qa 반영 #96
Merged
Merged
[Fix]: qa 반영 #96
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d1a5934
fix: 디스코드 관련 qa 반영
SeieunYoo b094392
feat : 인증을 완료한 경우에는 대시보드로 라우팅 하는 가드 설정
SeieunYoo ca30a99
Merge branch 'dev' into fix/seieun-qa
eugene028 206c1f6
fix: username 닉네임 잘못된 부분 수정
eugene028 47368bf
fix: 대기중 문구만 뜨는 것 고치기
eugene028 473037f
fix: console log 삭제
SeieunYoo c35a8c5
fix: 합류 확인 여부 리팩토링
eugene028 5b7d0aa
fix: 로그인 코드 변경
eugene028 99d182b
Merge branch 'fix/seieun-qa' of https://github.com/GDSC-Hongik/gdsc-c…
eugene028 1cc4856
fix:joinServer 안내문구
eugene028 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import RoutePath from '@/routes/routePath'; | ||
import { toast } from 'react-toastify'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { PropsWithChildren, useEffect } from 'react'; | ||
import memberApi from '@/apis/member/memberApi'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
type GuardType = 'StudentVerification' | 'Discord' | 'SignUp' | 'Bevy'; | ||
|
||
interface VerificationGuardProps extends PropsWithChildren { | ||
guardType: GuardType; | ||
} | ||
/** 기본 정보, 디스코드 정보, 이메일 정보가 인증되어 있는지에 대한 가드 */ | ||
|
||
export default function VerificationGuard({ | ||
guardType, | ||
children | ||
}: VerificationGuardProps) { | ||
const navigate = useNavigate(); | ||
const { data } = useQuery({ | ||
queryKey: ['member'], | ||
queryFn: memberApi.GET_DASHBOARD | ||
}); | ||
|
||
useEffect(() => { | ||
if (!data) return; | ||
|
||
if ( | ||
guardType === 'SignUp' && | ||
data.member.associateRequirement.infoStatus === 'SATISFIED' | ||
) { | ||
toast.error('기본 정보를 이미 입력했습니다.'); | ||
navigate(RoutePath.Dashboard); | ||
return; | ||
} | ||
if ( | ||
guardType === 'Discord' && | ||
data.member.associateRequirement.discordStatus === 'SATISFIED' | ||
) { | ||
toast.error('디스코드 연동을 이미 완료했습니다.'); | ||
navigate(RoutePath.Dashboard); | ||
return; | ||
} | ||
if ( | ||
guardType === 'StudentVerification' && | ||
data.member.associateRequirement.univStatus === 'SATISFIED' | ||
) { | ||
toast.error('재학생 인증을 이미 완료했습니다.'); | ||
navigate(RoutePath.Dashboard); | ||
return; | ||
} | ||
if ( | ||
guardType === 'Bevy' && | ||
data.member.associateRequirement.bevyStatus === 'SATISFIED' | ||
) { | ||
toast.error('bevy 가입을 이미 완료했습니다.'); | ||
navigate(RoutePath.Dashboard); | ||
return; | ||
} | ||
}, [data, guardType, navigate]); | ||
|
||
return children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import discordApi from '@/apis/discord/discordApi'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
export function usePostDiscordName(userName: string) { | ||
export function usePostDiscordName() { | ||
const { mutate: checkDuplicate, ...rest } = useMutation({ | ||
mutationFn: () => discordApi.GET_DISCORD_NAME(userName) | ||
mutationFn: (userName: string) => discordApi.GET_DISCORD_NAME(userName) | ||
}); | ||
return { checkDuplicate, ...rest }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import discordApi from '@/apis/discord/discordApi'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
export function usePostDiscordNickname(nickname: string) { | ||
export function usePostDiscordNickname() { | ||
const { mutate: checkDuplicate, ...rest } = useMutation({ | ||
mutationFn: () => discordApi.GET_DISCORD_NICKNAME(nickname) | ||
mutationFn: (nickname: string) => discordApi.GET_DISCORD_NICKNAME(nickname) | ||
}); | ||
return { checkDuplicate, ...rest }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p4;
useQuery
쪽에서 설정하신refetchInterval
옵션만으로 5초마다 폴링을 해볼 수 있을 것 같아요. 해당 로직이 꼭 필요한 이유가 있을까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 이 부분은 refetchInterval 을 통해서 5초마다 refetch 될 거라고 생각했는데 확인하셨을 때 잘 동작하지 않았던 걸까용?! @eugene028
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 제가 이거저거 테스트해보면서 별다른 고려없이
refetch
넣었던 것 같아요~ 요거 수정해두겠습니다