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

Use of data stored in local storage doesn't have a time frame. #17

Open
nibble0101 opened this issue Oct 28, 2020 · 0 comments
Open

Use of data stored in local storage doesn't have a time frame. #17

nibble0101 opened this issue Oct 28, 2020 · 0 comments
Assignees
Labels
bug Something isn't working press Can be fixed inside the press component

Comments

@nibble0101
Copy link
Owner

nibble0101 commented Oct 28, 2020

In the Press component, data is fetched from the New York Times API and stored in local storage so that the data is retrieved and used if it already exists next time the client navigates to this page. The data already in local storage however is used indefinitely yet new articles are being added to the API periodically.

It is therefore important to add a time frame within which data in local storage is usable. This can be 24 hours, 48 hours e.t.c
This can be achieved by adding the current date from Date.now() and deferring data retrieval from the API if the difference between Date.now() and date in local storage is less than 24 * 60 * 60 * 1000. Of course the 24 is if it is decided that the "expiry" time frame is 24 hours.

@nibble0101 nibble0101 added the bug Something isn't working label Oct 28, 2020
@nibble0101 nibble0101 changed the title Use of data stored in local storage doesn't have a trime frame. Use of data stored in local storage doesn't have a time frame. Oct 28, 2020
@nibble0101 nibble0101 added the press Can be fixed inside the press component label Oct 28, 2020
@nibble0101 nibble0101 self-assigned this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working press Can be fixed inside the press component
Projects
None yet
Development

No branches or pull requests

1 participant