-
Notifications
You must be signed in to change notification settings - Fork 0
Save review text #78
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
Save review text #78
Conversation
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.
Looks gucci. Just a few modifications
Co-authored-by: ChinathaiP <92321280+chinathaip@users.noreply.github.com> Signed-off-by: Anascence <58430236+NayHtetKyaw@users.noreply.github.com>
…tax-club/course-compose into ana/save-reviewtext
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.
A bit of inaccuracy na. Don't forget to format the code. Also, I've seen the keys reviewFormXXXXX
being referred a lot and there's actually one mismatch key. Consider defining them as a function that returns the key with dynamic course code. For example
// ofc rename it better lol
interface reviewFormKey {
academicYearKey: string;
ratingKey: string;
descriptionKey: string;
}
const createReviewFormKey = (courseCode: string): reviewFormKey => {
return {
academicYearKey: `reviewFormAcademicYear_${courseCode}`,
ratingKey: `reviewFormDescription_${courseCode}`,
descriptionKey: `reviewFormDescription_${courseCode}`
}
}
Now you can always use it like this so everything is consistent
const reviewKeys = createReviewFormKey(params.coursecode);
localStorage.removeItem(reviewKeys.academicYearKey);
localStorage.removeItem(reviewKeys.ratingKey);
localStorage.removeItem(reviewKeys.descriptionKey);
localStorage.getItem(reviewKeys.academicYearKey);
localStorage.getItem(reviewKeys.ratingKey);
localStorage.getItem(reviewKeys.descriptionKey);
or so.. Try this and see if it works or not. Maybe even create the reviewKeys with useMemo with the course code as dependency
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.
LGTM!
Create a temporary localstorage to save the review inputs even when the page got refresh, the inputs will still remain>