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

NetworkError when attempting to fetch resource. #30

Open
iliassanati opened this issue Oct 9, 2023 · 0 comments
Open

NetworkError when attempting to fetch resource. #30

iliassanati opened this issue Oct 9, 2023 · 0 comments

Comments

@iliassanati
Copy link

with the of :
useEffect(() => {
const storedLocation = JSON.parse(
localStorage.getItem(currentUser.id)
)?.location;
if (!lng && !lat && !storedLocation?.lng && !storedLocation?.lat) {
fetch('https://ipapi.co/json')
.then((response) => {
return response.json();
})
.then((data) => {
dispatch({
type: 'UPDATE_LOCATION',
payload: { lng: data.longitude, lat: data.latitude },
});
});
}
}, []);

the fetch method gives this error : NetworkError when attempting to fetch resource.

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

No branches or pull requests

1 participant