-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into REV-99/로그인-모킹
- Loading branch information
Showing
16 changed files
with
534 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
export { default as useLogin } from './useLogin' | ||
export { default as useSignUp } from './useSignUp' | ||
export { default as useCheckDuplicatedName } from './useCheckDuplicatedName' | ||
export { default as useCheckDuplicatedEmail } from './useCheckDuplicatedEmail' | ||
export { default as useGetInvitedReview } from './useGetInvitedReview' | ||
export { default as useGetCreatedReview } from './useGetCreatedReview' | ||
export { default as useGetReceivedReview } from './useGetReceivedReview' | ||
export { default as useGetReviewResult } from './useGetReviewResult' | ||
export { default as useGetResponseForm } from './useGetResponseForm' | ||
export { default as useEditResponse } from './useEditResponse' |
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,16 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
interface checkDuplicatedEmailProps { | ||
email: string | ||
} | ||
|
||
const useCheckDuplicatedEmail = () => { | ||
const checkDuplicatedEmail = async (email: checkDuplicatedEmailProps) => { | ||
return await apiClient.post('/members/check-email', email) | ||
} | ||
|
||
return useMutation({ mutationFn: checkDuplicatedEmail }) | ||
} | ||
|
||
export default useCheckDuplicatedEmail |
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,16 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
interface checkDuplicatedNameProps { | ||
name: string | ||
} | ||
|
||
const useCheckDuplicatedName = () => { | ||
const checkDuplicatedName = async (name: checkDuplicatedNameProps) => { | ||
return await apiClient.post('/members/check-name', name) | ||
} | ||
|
||
return useMutation({ mutationFn: checkDuplicatedName }) | ||
} | ||
|
||
export default useCheckDuplicatedName |
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,28 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
interface Answer { | ||
questionId: number | ||
questionType: string | ||
answer: string[] | ||
} | ||
|
||
interface Result { | ||
reviewerId: number | ||
answers: Answer[] | ||
} | ||
|
||
interface Response { | ||
responseId: number | ||
results: Result[] | ||
} | ||
|
||
const useEditResponse = () => { | ||
const editResponse = async (data: Response) => { | ||
return await apiClient.put('/invited-surveys', data) | ||
} | ||
|
||
return useMutation({ mutationFn: editResponse }) | ||
} | ||
|
||
export default useEditResponse |
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,17 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
const useGetCreatedReview = () => { | ||
const getCreatedReview = async () => { | ||
const response = await apiClient.get('/created-surveys') | ||
|
||
return response.data | ||
} | ||
|
||
return useQuery({ | ||
queryKey: ['/created-surveys'], | ||
queryFn: getCreatedReview, | ||
}) | ||
} | ||
|
||
export default useGetCreatedReview |
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,17 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
const useGetInvitedReview = () => { | ||
const getInvitedReview = async () => { | ||
const response = await apiClient.get('/invited-surveys') | ||
|
||
return response.data | ||
} | ||
|
||
return useQuery({ | ||
queryKey: ['/invited-surveys'], | ||
queryFn: getInvitedReview, | ||
}) | ||
} | ||
|
||
export default useGetInvitedReview |
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,17 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
const useGetReceivedReview = () => { | ||
const getReceivedReview = async () => { | ||
const response = await apiClient.get('/received-reviews') | ||
|
||
return response.data | ||
} | ||
|
||
return useQuery({ | ||
queryKey: ['/received-reviews'], | ||
queryFn: getReceivedReview, | ||
}) | ||
} | ||
|
||
export default useGetReceivedReview |
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,17 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
const useGetResponseForm = (reviewId: number) => { | ||
const getResponseForm = async () => { | ||
const response = await apiClient.get(`/invited-surveys/${reviewId}`) | ||
|
||
return response.data | ||
} | ||
|
||
return useQuery({ | ||
queryKey: ['/invited-surveys/${reviewId}'], | ||
queryFn: getResponseForm, | ||
}) | ||
} | ||
|
||
export default useGetResponseForm |
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,17 @@ | ||
import { useQuery } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
const useGetReviewResult = (reviewId: number) => { | ||
const getReviewResult = async () => { | ||
const response = await apiClient.get(`/received-reviews/${reviewId}`) | ||
|
||
return response.data | ||
} | ||
|
||
return useQuery({ | ||
queryKey: ['/received-reviews/${reviewId}'], | ||
queryFn: getReviewResult, | ||
}) | ||
} | ||
|
||
export default useGetReviewResult |
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,18 @@ | ||
import { useMutation } from '@tanstack/react-query' | ||
import apiClient from '../apiClient' | ||
|
||
interface signUpProps { | ||
email: string | ||
name: string | ||
password: string | ||
} | ||
|
||
const useSignUp = () => { | ||
const signUp = async (user: signUpProps) => { | ||
return await apiClient.post('/sign-up', user) | ||
} | ||
|
||
return useMutation({ mutationFn: signUp }) | ||
} | ||
|
||
export default useSignUp |
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,180 @@ | ||
export const MY_INFO = { | ||
id: 1, | ||
name: '[프론트엔드]김아무개', | ||
email: '[email protected]', | ||
} | ||
|
||
export const INVITED_REVIEWS = [ | ||
{ | ||
surveyResultId: 1, | ||
title: '데브코스 3차 리뷰', | ||
deadlineStatus: '진행중', | ||
surveyType: '피어 리뷰', | ||
isCompleted: false, | ||
createdAt: '2023-10-31T10:30:25', | ||
}, | ||
{ | ||
surveyResultId: 2, | ||
title: '데브코스 프론트엔드 그냥 저냥 어쩌구 리뷰', | ||
deadlineStatus: '진행중', | ||
surveyType: '피어 리뷰', | ||
isCompleted: false, | ||
createdAt: '2023-10-26T10:30:25', | ||
}, | ||
{ | ||
surveyResultId: 3, | ||
title: '데브코스 2차 리뷰', | ||
deadlineStatus: '마감', | ||
surveyType: '피어 리뷰', | ||
isCompleted: true, | ||
createdAt: '2023-09-01T10:30:25', | ||
}, | ||
{ | ||
surveyResultId: 3, | ||
title: '데브코스 1차 리뷰', | ||
deadlineStatus: '종료', | ||
surveyType: '피어 리뷰', | ||
isCompleted: true, | ||
createdAt: '2023-07-31T10:30:25', | ||
}, | ||
] | ||
|
||
export const CREATED_REVIEWS = [ | ||
{ | ||
surveyId: 1, | ||
title: '데브코스 3차 리뷰', | ||
deadlineStatus: '진행중', | ||
responserCount: 3, | ||
surveyType: '피어 리뷰', | ||
createdAt: '2023-10-31T10:30:25', | ||
}, | ||
{ | ||
surveyId: 2, | ||
title: '데브코스 1차 리뷰', | ||
deadlineStatus: '종료', | ||
responserCount: 60, | ||
surveyType: '피어 리뷰', | ||
createdAt: '2023-07-31T10:30:25', | ||
}, | ||
] | ||
|
||
export const RECEIVED_REVIEWS = [ | ||
{ | ||
afterResultId: 1, | ||
title: '데브코스 1차 리뷰', | ||
createdAt: '2023-07-31T10:30:25', | ||
}, | ||
] | ||
|
||
export const REVIEW_QUESTION = { | ||
title: 'title', | ||
description: 'description', | ||
responsers: [ | ||
{ responderId: 1, responderName: '[프론트엔드]김아무개' }, | ||
{ responderId: 2, responderName: '[프론트엔드]김잼민' }, | ||
{ responderId: 3, responderName: '[프론트엔드]김빡빡' }, | ||
], | ||
questions: [ | ||
{ | ||
questionId: 1, | ||
questionTitle: '이 사람의 강점은?', | ||
questionType: 'multipleChoice', | ||
isRequired: true, | ||
options: ['협업', '커뮤니케이션', '스킬', '소통'], | ||
}, | ||
{ | ||
questionId: 2, | ||
questionTitle: '이 사람의 단점은?', | ||
questionType: 'subjective', | ||
isRequired: true, | ||
options: [], | ||
}, | ||
{ | ||
questionId: 3, | ||
questionTitle: '이 사람의 성향은?', | ||
questionType: 'singleChoice', | ||
isRequired: true, | ||
options: ['섬세', '리더십', '차분', '잼민'], | ||
}, | ||
{ | ||
questionId: 4, | ||
questionTitle: '답변자의 성별을 선택해주세요.', | ||
questionType: 'dropdown', | ||
isRequired: true, | ||
options: ['남자', '여자'], | ||
}, | ||
{ | ||
questionId: 5, | ||
questionTitle: '이 사람의 코딩 점수는 몇점?', | ||
questionType: 'starRating', | ||
isRequired: true, | ||
options: [], | ||
}, | ||
{ | ||
questionId: 6, | ||
questionTitle: '이 사람의 스탯을 선택 부탁드려유', | ||
questionType: 'hexagonStat', | ||
isRequired: true, | ||
maxScore: 5, | ||
options: ['협업', '커뮤니케이션', '스킬', '소통'], | ||
}, | ||
], | ||
} | ||
|
||
export const REVIEW_RESULT = { | ||
title: '데브코스 1차 피어리뷰', | ||
name: '김아무개', | ||
reviewDate: '어쩌구2023년날짜', | ||
results: [ | ||
{ | ||
questionTitle: '첫 포켓몬 고르면?', | ||
questionType: 'singleChoice', | ||
answers: [ | ||
'파이리', | ||
'파이리', | ||
'꼬부기', | ||
'이상해씨', | ||
'이상해씨', | ||
'이상해씨', | ||
'피카츄', | ||
'이브이', | ||
'이브이', | ||
], | ||
}, | ||
{ | ||
questionTitle: '이 사람의 코딩 점수는 몇점?', | ||
questionType: 'starRating', | ||
answers: [4, 3, 2, 2, 1, 1, 1, 0, 5], | ||
}, | ||
{ | ||
questionTitle: '이 사람의 스탯을 선택 부탁드려유', | ||
questionType: 'hexagonStat', | ||
answers: [ | ||
{ | ||
label: '협업', | ||
score: 5, | ||
}, | ||
{ | ||
label: '커뮤니케이션', | ||
score: 3, | ||
}, | ||
{ | ||
label: '스킬', | ||
score: 2, | ||
}, | ||
{ | ||
label: '소통', | ||
score: 1, | ||
}, | ||
], | ||
}, | ||
{ | ||
questionTitle: '이 사람의 단점은?', | ||
questionType: 'hexagonStat', | ||
answers: | ||
'김아무개님은 팀 프로젝트를 위해 솔선수범하는 모습을 자주 보여줍니다. 하지만 PR리뷰를 대충 작성하시고, 강한 자기주장으로 인해 팀원간에 마찰이 자주 발생하였습니다. 가끔은 좋은 자료들을 많이 공유해주셔서 팀원들의 역량을 늘리는데 기여하기도 합니다. 조금 더 팀원 입장에서 생각해주시면 훨씬 좋은 개발자가 되실 것 같습니다!', | ||
}, | ||
], | ||
} | ||
|
||
export const REVIEW_RESPONSE = {} |
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 +1,3 @@ | ||
export { loginHandlers } from './login' | ||
export { signUpHandlers } from './signUp' | ||
export { mainHandlers } from './main' |
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,29 @@ | ||
import { rest } from 'msw' | ||
import { | ||
CREATED_REVIEWS, | ||
INVITED_REVIEWS, | ||
RECEIVED_REVIEWS, | ||
REVIEW_QUESTION, | ||
REVIEW_RESULT, | ||
} from './dummyData' | ||
|
||
export const mainHandlers = [ | ||
rest.get('/invited-surveys', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(INVITED_REVIEWS)) | ||
}), | ||
rest.get('/created-surveys', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(CREATED_REVIEWS)) | ||
}), | ||
rest.get('/received-reviews', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(RECEIVED_REVIEWS)) | ||
}), | ||
rest.get('/invited-surveys/:surveyResultId', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(REVIEW_QUESTION)) | ||
}), | ||
rest.get('/received-reviews/:afterResultId', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json(REVIEW_RESULT)) | ||
}), | ||
rest.put('/invited-surveys', async (_, res, ctx) => { | ||
return res(ctx.status(200), ctx.json({ success: true })) | ||
}), | ||
] |
Oops, something went wrong.