-
Notifications
You must be signed in to change notification settings - Fork 7
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-fe: 이메일 발송 내역 조회 #970
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: Jeongwoo Park <[email protected]> Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Seongjin Hong <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Seongjin Hong <[email protected]>
1736864820.768509 |
1736864823.314289 |
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeongwoo Park <[email protected]> Co-authored-by: Kim Da Eun <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Seongjin Hong <[email protected]>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Kim Da Eun <[email protected]>
1738834023.774879 |
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주간 발효된 PR도 맛있네요. 김치처럼
코멘트 확인 부탁드립니🙇♂️
&:hover { | ||
cursor: pointer; | ||
} |
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.
해당 hover 이벤트가 잘못 적용되어있는 듯 해요.
메뉴 내부 각각의 요소에 들어가야 할 것 같습니다!
const { data: { emailResponses: emailHistory } = { emailResponses: [] } } = useQuery({ | ||
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId], | ||
queryFn: () => emailApis.history({ clubId, applicantId }), | ||
}); |
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.
초기값은 initalData 속성을 사용하는게 어떨까요?
조금 더 직관적으로 느껴지는데, 어떻게 생각하실까용
const { data: { emailResponses: emailHistory } = { emailResponses: [] } } = useQuery({ | |
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId], | |
queryFn: () => emailApis.history({ clubId, applicantId }), | |
}); | |
const { | |
data: { emailResponses: emailHistory }, | |
} = useQuery({ | |
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId], | |
initialData: { emailResponses: [] }, | |
queryFn: () => emailApis.history({ clubId, applicantId }), | |
}); |
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.
추가로 이메일 보냈을때 해당 응답에 대한 revalidate가 추가되면 좋겠어요!
혹은 refetch 요청 없이 캐싱값만 수정해도 되겠구용!
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.
응답에 대한 revalidate가 어떤 건지 이해하지 못했어요. 어떤 케이스가 있는지 설명해주실 수 있을까용?
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.
초기값은 initalData 속성을 사용하는게 어떨까요?
initialData 속성을 까먹고 있었네요. 반영하겠습니다~
frontend/src/api/domain/email.ts
Outdated
@@ -32,6 +33,9 @@ const emailApis = { | |||
path: '/verify-code', | |||
body: { email, verificationCode }, | |||
}), | |||
|
|||
history: async (params: { clubId: string; applicantId: number }) => | |||
apiClient.get<{ emailResponses: Email[] }>({ path: `/${params.clubId}/${params.applicantId}` }), |
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.
응답값의 객체 이름은 emailHistoryResponses으로 변경되었나봐요!
|
||
const handleSubmit = (e: React.FormEvent) => { | ||
e.preventDefault(); | ||
if (subject && content && !subjectError && !contentError) { | ||
onSubmit({ subject, content }); | ||
} | ||
if (!subject) setSubjectError('제목을 입력해주세요.'); | ||
|
||
if (!content) setContentError('내용을 입력해주세요.'); | ||
}; |
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.
이곳에 email history에 대한 refetch 혹은 Optimistic Update로직이 들어가면 좋겠습니다
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.
cache invalidation을 해서 refetch를 해주고 있는데 새로운 정보로 업데이트가 안되고 있었네요.
서버에서 이메일을 보내고 사용자 정보 DB에 이메일 전송 내역을 업데이트하기까지 갭이 있어 그런 것 같습니다.
이를 다음과 같이 대응했습니다.
- 새로운 이메일 전송 내역을 '전송중' 표시하여 낙관적 업데이트 적용.
- 5초 뒤 cache invalidation을 실행해 실제 refetch를 이룸.
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.
스바라시하게 업그레이드 되었네요..👍
const formattedDate = new Date(createdDate).toLocaleDateString('ko-KR', { month: 'long', day: 'numeric' }); | ||
const formattedTime = new Date(createdDate).toLocaleTimeString('ko-KR', { hour: 'numeric', minute: 'numeric' }); |
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.
로컬 설정까지 👍
@lurgi
|
const FIVE_SECONDS = 5000; | ||
setTimeout(() => { | ||
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantIds[0]] }); | ||
}, FIVE_SECONDS); |
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.
백엔드 코드 수정 요청후 변경되어야 하겠네용
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.
아쌈
목적
작업 세부사항
작업 결과
리팩토링 참고
기존 MessageForm 컴포넌트를 재사용하기 위해 Compound Pattern을 사용해 리팩토링했습니다.
이에 따라 아래 요소로 분리되었습니다. 오랜만에 리팩토링하니까 개운하고 재밌네요^^
구성 요소는 아래와 같습니다.
EMAIL_01
closes #969