Skip to content

Commit

Permalink
refactor: update import, clearer name
Browse files Browse the repository at this point in the history
  • Loading branch information
GV14982 committed Feb 26, 2025
1 parent 07f50aa commit 59e1f33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import MapPage from 'components/MapPage/MapPage';
import theme from 'theme';
import store from 'store';
import { Provider } from 'react-redux';
import GeoLocationTracker from 'components/GeolocationTracker/GeolocationTracker';
import GeolocationTracker from 'components/GeolocationTracker/GeolocationTracker';

const App = () => {
initAnalytics();
logPageView();
return (
<Provider store={store}>
<ThemeProvider theme={theme}>
<GeoLocationTracker />
<GeolocationTracker />
<CssBaseline />
<div className="page-wrapper">
<Head />
Expand Down
10 changes: 5 additions & 5 deletions src/components/GeolocationTracker/GeolocationTracker.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { updateUserLocationEnabled } from '../../reducers/user';
import { updateUserLocationEnabled } from 'reducers/user';

const GeoLocationTracker = () => {
const GeolocationTracker = () => {
const dispatch = useDispatch();
useEffect(() => {
function setUserLocationEnabled(payload) {
dispatch(updateUserLocationEnabled(payload));
}
async function queryGeolocationPerms() {
async function queryGeolocationPermissions() {
const perms = await navigator.permissions.query({ name: 'geolocation' });
setUserLocationEnabled(perms.state === 'granted');
perms.addEventListener('change', () => {
Expand Down Expand Up @@ -55,7 +55,7 @@ const GeoLocationTracker = () => {
);
// This is the sensible way to handle it...
} else {
queryGeolocationPerms();
queryGeolocationPermissions();
}
return () => {
clearInterval(interval);
Expand All @@ -64,4 +64,4 @@ const GeoLocationTracker = () => {
return null;
};

export default GeoLocationTracker;
export default GeolocationTracker;

0 comments on commit 59e1f33

Please sign in to comment.