mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
fix(error merge): fixed error induced with wrong merge
This commit is contained in:
+16
-28
@@ -17,7 +17,11 @@ const MapWithNoSSR = dynamic(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export default function Map() {
|
export default function Map() {
|
||||||
const [location, setLocation] = useState<number[]>([]);
|
const [location, setLocation] = useState([
|
||||||
|
null as unknown as number,
|
||||||
|
null as unknown as number,
|
||||||
|
]);
|
||||||
|
|
||||||
const [geolocationError, setGeolocationError] = useState(false);
|
const [geolocationError, setGeolocationError] = useState(false);
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const [listBars, setListBars] = useState({} as unknown as any);
|
const [listBars, setListBars] = useState({} as unknown as any);
|
||||||
@@ -112,19 +116,10 @@ export default function Map() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!session?.user) return;
|
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(
|
navigator.geolocation.getCurrentPosition(
|
||||||
(position: GeolocationPosition) => {
|
successPosition,
|
||||||
setLocation([position.coords.latitude, position.coords.longitude]);
|
errorPosition,
|
||||||
setGeolocationError(false);
|
geolocationOptions
|
||||||
},
|
|
||||||
() => setGeolocationError(true),
|
|
||||||
{
|
|
||||||
enableHighAccuracy: true,
|
|
||||||
timeout: 5000,
|
|
||||||
maximumAge: 0,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}, [loggedUser]);
|
}, [loggedUser]);
|
||||||
|
|
||||||
@@ -139,22 +134,15 @@ export default function Map() {
|
|||||||
setLocation([position.coords.latitude, position.coords.longitude]);
|
setLocation([position.coords.latitude, position.coords.longitude]);
|
||||||
setGeolocationError(false);
|
setGeolocationError(false);
|
||||||
|
|
||||||
for (const [key, val] of Object.entries(params)) {
|
if (!loggedUser) return;
|
||||||
urlBars.searchParams.append(key, val);
|
userSetLocation.mutate(
|
||||||
}
|
`${position.coords.latitude},${position.coords.longitude}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fetch(urlBars)
|
function errorPosition(error: GeolocationPositionError) {
|
||||||
.then(res => res.json())
|
setGeolocationError(true);
|
||||||
.then(data => {
|
}
|
||||||
const filteredBars = data.filter((bar: any) => bar.name !== null);
|
|
||||||
setListBars(filteredBars);
|
|
||||||
})
|
|
||||||
.catch(err => console.error(err));
|
|
||||||
}
|
|
||||||
}, [session?.user]);
|
|
||||||
|
|
||||||
if (status === 'loading') return <LoadingPage/>;
|
|
||||||
const {user} = session as unknown as Session;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user