-
Notifications
You must be signed in to change notification settings - Fork 0
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
[YS-176] 회원가입 로직 리팩토링 (연구자) #23
Changes from 27 commits
bc002e0
19e2482
22c02be
34f9764
ba13c1d
29211e6
538fe3d
44e6176
a7ca5cd
d55650c
b93f55a
21f71be
785c14c
b4e3252
b068230
f9b3d23
547588d
963ab35
2824436
a4c32fb
e9394e2
e833358
3d851f6
588c50a
e243fe0
6bcf857
231d972
99d747d
7c8985d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,13 @@ import { Area } from '@/app/home/home.types'; | |
import { API_URL } from '@/constants/url'; | ||
import { Post } from '@/types/post'; | ||
|
||
type PostResponse = Post[]; | ||
interface PostResponse { | ||
content: Post[]; | ||
isLast: boolean; | ||
page: number; | ||
size: number; | ||
totalCount: number; | ||
} | ||
Comment on lines
+7
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 응답 데이터 검증 로직 추가 필요
import { z } from 'zod';
const PostResponseSchema = z.object({
content: z.array(PostSchema),
isLast: z.boolean(),
page: z.number(),
size: z.number(),
totalCount: z.number()
}); |
||
|
||
export type AreaResponse = PostAreaResponse | PostSubAreaResponse; | ||
|
||
|
@@ -24,7 +30,7 @@ interface PostArea { | |
} | ||
|
||
export interface PostListParams { | ||
recruitDone: boolean; | ||
recruitStatus: 'ALL' | 'OPEN'; | ||
matchType?: 'ONLINE' | 'OFFLINE' | 'ALL'; | ||
gender?: '' | 'MALE' | 'FEMALE' | 'ALL'; | ||
age?: number; | ||
|
@@ -34,7 +40,7 @@ export interface PostListParams { | |
count?: number; | ||
} | ||
|
||
export const fetchPostList = async (params: PostListParams) => { | ||
export const fetchPostList = async (params: PostListParams = { recruitStatus: 'ALL' }) => { | ||
const queryParams = new URLSearchParams(); | ||
|
||
Object.entries(params).forEach(([key, value]) => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import { getResearcherInfo } from '@/apis/login'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { getResearcherInfo } from '@/apis/login'; | ||
|
||
export const useResearcherInfoQuery = () => { | ||
const role = sessionStorage.getItem('role'); | ||
const userRole = role === 'RESEARCHER' ? 'researchers' : 'participants'; | ||
|
||
return useQuery({ | ||
queryKey: ['researcherInfo'], | ||
queryFn: getResearcherInfo, | ||
enabled: !!role, | ||
enabled: !!userRole, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification 연구자 정보 쿼리 활성화 조건 수정 필요 현재 구현상 참여자 역할을 가진 사용자도 연구자 정보를 조회할 수 있습니다. 보안과 불필요한 API 호출을 방지하기 위해 다음과 같이 수정하는 것이 좋겠습니다: - enabled: !!userRole,
+ enabled: userRole === 'researchers', 🔗 Analysis chain
다음과 같이 수정하는 것을 고려해보세요: - enabled: !!userRole,
+ enabled: userRole === 'researchers', 🏁 Scripts executedThe following scripts were executed for the analysis: Error: No shell scripts found Script: #!/bin/bash
# Find the complete implementation of useResearcherInfoQuery
echo "=== useResearcherInfoQuery Implementation ==="
ast-grep --pattern 'export function useResearcherInfoQuery($_) {
$$$
}'
echo -e "\n=== useResearcherInfoQuery Hook Usage ==="
rg "useResearcherInfoQuery" -l
echo -e "\n=== Similar Query Hooks with Role Checks ==="
rg "enabled.*userRole" -A 2 -B 2
Length of output: 860 Script: #!/bin/bash
echo "=== useResearcherInfoQuery.ts Content ==="
cat src/app/home/hooks/useResearcherInfoQuery.ts
echo -e "\n=== Header.tsx Usage ==="
cat src/components/Header/Header.tsx
echo -e "\n=== Role Type Definitions ==="
rg "type.*Role|enum.*Role|interface.*Role" -A 3 -B 1
echo -e "\n=== Role Constants or Utils ==="
rg "Role.*=.*['\"]researchers['\"]" -A 2 -B 2
Length of output: 2667 |
||
retry: 1, | ||
}); | ||
}; |
This file was deleted.
This file was deleted.
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.
🛠️ Refactor suggestion
에러 처리를 추가해주세요.
네이버 로그인 API 호출 시 발생할 수 있는 에러에 대한 처리가 필요합니다.
📝 Committable suggestion