-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Feat/#155] react query 추가 #184
Conversation
PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶 |
Quality Gate failedFailed conditions |
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.
.
/** | ||
* This file was auto-generated by openapi-typescript. | ||
* Do not make direct changes to the file. | ||
*/ | ||
|
||
export interface paths { | ||
"/api/tickets/{performanceId}": { | ||
parameters: { | ||
query?: never; | ||
header?: never; | ||
path?: never; | ||
cookie?: never; | ||
}; |
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.
p5) 오 이건 뭘로 만드는 건가요?
// 3. 훅 불러와서 사용 | ||
const { data, isLoading } = useGetAllScheduleList(); | ||
|
||
const [genre, setGenre] = useState("ALL"); | ||
const [navigateUrl, setNavigateUrl] = useAtom(navigateAtom); |
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.
3
// 2. 쿼리 작성 | ||
export const useGuestBook = () => { | ||
const queryClient = new QueryClient(); | ||
|
||
return useMutation({ | ||
mutationFn: (formData: postGuestReq) => postGuestBook(formData), // API 요청 함수 | ||
onSuccess: (res) => { | ||
// 성공 시, 호출 | ||
queryClient.invalidateQueries({ queryKey: [QUERY_KEY.LIST] }); | ||
}, | ||
}); | ||
}; |
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.
2
// 1. API 요청 함수 작성 및 타입 추가 | ||
export const getAllScheduleList = async (): Promise<HomeResponse | null> => { | ||
try { | ||
const response: AxiosResponse<ApiResponseType<HomeResponse>> = await get("/main"); | ||
|
||
return response.data.data; | ||
} catch (error) { | ||
console.error("error", error); | ||
return null; |
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.
1
📌 관련 이슈번호
🎟️ PR 유형
어떤 변경 사항이 있나요?
✅ Key Changes
📢 To Reviewers
📸 스크린샷
🔗 참고 자료