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

Unnecessary requests #61

Open
LinaYahya opened this issue Aug 4, 2021 · 0 comments
Open

Unnecessary requests #61

LinaYahya opened this issue Aug 4, 2021 · 0 comments
Labels

Comments

@LinaYahya
Copy link

document.onreadystatechange = () => {
if (document.readyState === 'complete') {
fetchData('/movies-names', (data) => {
if (Number.isInteger(data)) moviesNames = JSON.parse(localStorage.getItem('moviesNames'));
else {
moviesNames = data;
localStorage.setItem('moviesNames', JSON.stringify(data));
}
});
}
};

Here you are getting your data from the server then you store it in local storage,
Every time the document load you did that even if your data stored in local stoarge!

Also why to do that!
Why to send all this data to client-side while I can filter my result on server-side!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant