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

[Frontend] Local storage handling #252

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

williammfu
Copy link
Collaborator

@williammfu williammfu commented Feb 3, 2022

Type of changes

Please check the type of change your PR introduces:

  • Bugfix
  • Enhancement
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behaviour?

There's a few instances where the picture stays on the cam uploader.

What is the new behavior?

Add a new function using useEffect which removes item from the localStorage everytime the component is mounted.

Checklist

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules
  • I have filled the [Unreleased] Changelog

Security Pentester API Checklist

  • IDOR
  • Malicious Script Injection
  • SQL Injection

Does this introduce a breaking change?

  • Yes
  • No

Other information

Please test the edge cases with different user flows

@sonadztux
Copy link
Collaborator

Emang sengaja dibuat masih Draft?

@williammfu
Copy link
Collaborator Author

williammfu commented Feb 3, 2022

Emang sengaja dibuat masih Draft?

Iya nan, jaga-jaga kalau ada case yg miss

Update: ready to review on 17:25 WIB

@williammfu williammfu marked this pull request as ready for review February 3, 2022 10:25
Comment on lines +48 to +52
useEffect(() => {
if (localStorage.getItem(ENROLL_SNAPSHOT)) {
localStorage.removeItem(ENROLL_SNAPSHOT)
}
}, [])
Copy link
Collaborator

@gregoriusjimmy gregoriusjimmy Feb 3, 2022

Choose a reason for hiding this comment

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

gw enroll face berhasil terus gw refresh, coba lagi, masih kesimpen foto sebelumnya tapi gabisa next. local storage disini bukannya emg tujuanya biar user ga perlu foto lagi kalo ke refresh/keluar halaman?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Noted, jim. Kadang kalo solution nya tengah jalan ditinggalin user, string base64 nya tetep disimpen di localStorage. Takut user nya kaget aja pas buka lagi abis udah lama ga buka.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Berarti di useEffectnya mesti ada condition buat ngecheck kalau session_idnya masih ada atau engga, kalau engga adaa berarti baru kita apus di local storagenya, kayak gitu?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Boleh kalo pengen nambah cek session_id jim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants