-
Notifications
You must be signed in to change notification settings - Fork 0
문의하기 ui api 연결 (#issue 256) #259
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8905a74
feat: 문의하기 라우터연결
YouD0313 0f7d73e
refactor: constant 컨벤션에따른 수정
YouD0313 2bbf3c1
feat: 문의하기 기능 ui formData 구현
YouD0313 e567a5e
feat: 문의 api 연결, 모달창 추후 기능구현추가예정
YouD0313 f9d538a
fix: http time out 수정
YouD0313 b7a30d7
refactor: 리뷰 적용, 값이 없을때 제출하지 못하게 막아놓기 // 추후 모달설정하기
YouD0313 ed5c7fc
refactor: form 데이터 state 하나의 객체로 관리하기
YouD0313 44d32c2
fix: customerService 디렉토리 pages로 이동
YouD0313 c185020
fix: pages 이동후 경로수정
YouD0313 c3b4cdd
fix: mypage 구조변경으로 인한 UserJoinProject.tsx 스타일드 에러와 타입오류 수정
YouD0313 6526cdf
refactor: 리뷰참고 수정-이미지 파일 용량 제한, url객체 해제
YouD0313 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 hidden or 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,14 @@ | ||
| import { httpClient } from './http.api'; | ||
|
|
||
| export const postInquiry = async (formData: FormData) => { | ||
| try { | ||
| const response = await httpClient.post('/inquiry', formData, { | ||
| headers: { | ||
| 'Content-Type': 'multipart/form-data', | ||
| }, | ||
| }); | ||
| console.log(response); | ||
| } catch (e) { | ||
| console.log('문의하기 에러', e); | ||
| } | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 +1,10 @@ | ||
| import { activityFilter } from '../../../constants/myPageFilter'; | ||
| import { ACTIVITY_FILTER } from '../../../constants/myPageFilter'; | ||
| import ContentTab from '../ContentTab'; | ||
|
|
||
| export default function ActivityLog() { | ||
| return ( | ||
| <> | ||
| <ContentTab $justifyContent='space-around' filter={activityFilter} /> | ||
| <ContentTab $justifyContent='space-around' filter={ACTIVITY_FILTER} /> | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or 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,8 +1,8 @@ | ||
| import { notificationFilter } from '../../../constants/myPageFilter'; | ||
| import { NOTIFICATION_FILTER } from '../../../constants/myPageFilter'; | ||
| import ContentTab from '../ContentTab'; | ||
|
|
||
| export default function Notifications() { | ||
| return ( | ||
| <ContentTab $justifyContent='space-between' filter={notificationFilter} /> | ||
| <ContentTab $justifyContent='space-between' filter={NOTIFICATION_FILTER} /> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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,14 @@ | ||
| export const INQUIRY_CATEGORY = [ | ||
| { title: '사이트 오류' }, | ||
| { title: '공고모집' }, | ||
| { title: '제안하기' }, | ||
| { title: '기타' }, | ||
| ] as const; | ||
|
|
||
| export const EMPTY_IMAGE = | ||
| 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' as const; | ||
|
|
||
| export const INQUIRY_MESSAGE = { | ||
| categoryDefault: '카테고리', | ||
| fileDefault: '선택된 파일이 없습니다.', | ||
| }; |
This file contains hidden or 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 hidden or 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, useQueryClient } from '@tanstack/react-query'; | ||
| import { postInquiry } from '../api/inquiry.api'; | ||
| import { AxiosError } from 'axios'; | ||
|
|
||
| export const usePostInquiry = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| const mutate = useMutation<void, AxiosError, FormData>({ | ||
| mutationFn: (formData) => postInquiry(formData), | ||
| onSuccess: () => { | ||
| queryClient.invalidateQueries(); | ||
| }, | ||
| }); | ||
|
Comment on lines
+8
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 useMutation이 API 함수의 반환 값과 일치하도록 업데이트가 필요합니다. 현재 API 함수를 다음과 같이 수정하는 것을 권장합니다: export const postInquiry = async (formData: FormData) => {
const response = await httpClient.post('/inquiry', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
return response.data;
};이렇게 수정하면 에러를 적절히 전파하고 결과 데이터를 반환하여 훅에서 더 효과적으로 처리할 수 있습니다. |
||
|
|
||
| return mutate; | ||
| }; | ||
This file contains hidden or 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,5 @@ | ||
| export interface InquiryFormData { | ||
| category: string; | ||
| title: string; | ||
| content: string; | ||
| } |
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...mmon/customerService/MoveInquiredLink.tsx → ...ages/customerService/MoveInquiredLink.tsx
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
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.
🛠️ Refactor suggestion
에러 처리 및 반환 값 개선이 필요합니다
현재 API 함수는 console.log를 사용하여 응답과 오류를 기록하고 있으며, 반환 값이 없습니다. 이는 호출하는 컴포넌트에서 성공/실패 여부를 확인하기 어렵게 만듭니다.
다음과 같이 개선하는 것을 추천합니다:
이렇게 수정하면:
📝 Committable suggestion