Skip to content

Commit

Permalink
Show message for location fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
borsemayur2 committed Jun 20, 2021
1 parent b31c1c2 commit 22743b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/weather/components/LocationSetter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default function LocationSetter() {

const requestLatLong = () => {
const onSuccess = (position) => {
setMessage({
content: "Location set successfully.",
severity: "success",
});
dispatch(
setLocation({
location: {
Expand All @@ -28,6 +32,10 @@ export default function LocationSetter() {
});
};
if ("geolocation" in navigator) {
setMessage({
content: "Fetching current location...",
severity: "info",
});
navigator.geolocation.getCurrentPosition(onSuccess, onError);
} else {
setMessage({
Expand Down

0 comments on commit 22743b3

Please sign in to comment.