Skip to content
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

Merged
merged 19 commits into from
Jul 16, 2024
Merged

[Feat/#155] react query 추가 #184

merged 19 commits into from
Jul 16, 2024

Conversation

pepperdad
Copy link
Member

📌 관련 이슈번호

🎟️ PR 유형

어떤 변경 사항이 있나요?

  • 새 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 리팩토링

✅ Key Changes

이번 PR에서 작업한 내용을 간략히 설명해주세요

  1. React-query 추가
  2. useQuery(), useMutation() 예시 추가

📢 To Reviewers

  • get 요청 시, useQuery(), post 요청 시, useMutation() 사용하시면 됩니다!
  • 주석에 적힌 번호대로 따라서 하면 편합니다!
  • swagger의 Response Schema에 따라 타입 작성하면 됩니다!

📸 스크린샷

🔗 참고 자료

@github-actions github-actions bot requested review from imddoy, ocahs9 and sinji2102 July 16, 2024 15:22
@github-actions github-actions bot added the ✨ FEAT 기능 구현 label Jul 16, 2024
Copy link

PR 작성하느라 고생 많았어요!! 라벨 잘 지정되었는지 확인 한 번 해 주기 🫶

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
17.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@pepperdad pepperdad merged commit df970bf into develop Jul 16, 2024
3 of 5 checks passed
Copy link
Contributor

@ocahs9 ocahs9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Comment on lines +1 to +13
/**
* 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;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) 오 이건 뭘로 만드는 건가요?

Comment on lines +19 to +23
// 3. 훅 불러와서 사용
const { data, isLoading } = useGetAllScheduleList();

const [genre, setGenre] = useState("ALL");
const [navigateUrl, setNavigateUrl] = useAtom(navigateAtom);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

Comment on lines +8 to +19
// 2. 쿼리 작성
export const useGuestBook = () => {
const queryClient = new QueryClient();

return useMutation({
mutationFn: (formData: postGuestReq) => postGuestBook(formData), // API 요청 함수
onSuccess: (res) => {
// 성공 시, 호출
queryClient.invalidateQueries({ queryKey: [QUERY_KEY.LIST] });
},
});
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2

Comment on lines +8 to +16
// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ FEAT 기능 구현
Projects
Status: 🎉Done
Development

Successfully merging this pull request may close these issues.

[ Feat ] React-query 세팅 및 예시 추가
2 participants