-
Notifications
You must be signed in to change notification settings - Fork 1
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: temporary storage feature for activity report creation using localstorage #1385
base: dev
Are you sure you want to change the base?
feat: temporary storage feature for activity report creation using localstorage #1385
Conversation
.npmrc
Outdated
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.
아 ㅋㅋㅋ 내 설정 만지다가 실수로 같이 업로드됐네여! 지울게~
Return .npmrc to its original version
음 뭔가 활보쪽에서만 쓰이지 않고 지원금 쪽이나 나중에 다른 곳에서도 쓰일거 같아서 이걸 매번 각각 그 feature의 코드 파일에 직접 추가하는 것보단 뭔가 추상화해서 밖으로 빼서 common에 넣을 방법이 없을라나..? 흠 나도 좀 더 찾아볼게 |
…generalize local storage usage
1f80e1b
to
55baaf7
Compare
현재 임시저장 관련 사용되는 local storage 함수가 |
흠 그리고 로컬 스토리지에 이 데이터만 있는게 아니어서 임시저장으로 인해 스토리지에 추가하는거를 일괄로 구분할 수 있게 앞에 뭔가 prefix를 공통으로 붙이고 되게 key를 넣으면 좋을거 같은데 prefix를 뭘 붙이면 좋을진 모르겠어 |
const getLocalStorage = <T>(name: string) => { | ||
const rawData = localStorage.getItem(name); | ||
if (rawData !== null) { | ||
const storedData = JSON.parse(rawData) as T; |
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.
혹시나 여기 parse 하다가 에러 날 수도 있으니까 try catch로 감싸는건 어때?
|
||
const getLocalStorage = <T>(name: string) => { | ||
const rawData = localStorage.getItem(name); | ||
if (rawData !== 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.
괜찮을거 같긴 한데 혹시나 undefined가 들어가게 될 수도 있으니까 null이랑 undefined 다 커버할 수 있는 rawData != null
로 하면 좋을거 같아
const location = watch("location"); | ||
const purpose = watch("purpose"); | ||
const detail = watch("detail"); | ||
const evidence = watch("evidence"); |
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.
뭔가 이거 하나하나 추가할 필요없이 watch() 하면 전체 데이터 다 받아올 수 있을거 같은데?
@@ -82,6 +91,30 @@ const ActivityReportForm: React.FC<ActivityReportFormProps> = ({ | |||
endTerm, | |||
}); | |||
|
|||
useEffect(() => { | |||
saveLocalStorage("activity-report", { |
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.
activity-report는 파일 상단 혹은 constant에 따로 const 로 정의하면 좋을거 같아
그리고 위에 수정사항들 다 되면 지원금 신청 페이지에도 반영 부탁해요~ |
그리고 가능하면 class에 만료시간 설정 할 수 있는 로직도 추가되면 좋을거 같다 |
…al errors & simplify watch() & constant param
eb0e465
to
2dcb123
Compare
…eport' of https://github.com/academic-relations/ar-002-clubs into 1379-implement-temporary-storage-feature-for-activity-report
3086d51
to
1f9a86a
Compare
요약 *
활동보고서 create 하는 화면에서 종종 로그인 토큰이 만료되어서 튕기는 경우가 있는데, 이 때 작업한 결과물이 모두 날아가는 것을 방지하기 위해서 임시저장 기능을 추가했습니다.
코드에서 그냥 ActivityReportFormData라는 interface를 사용하지 않고 각 element를 쪼개서 작업한 이유 :
It closes #1379
스크린샷
이후 Task *