mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
fix(BUG Carte): error first load map
This commit is contained in:
@@ -7,7 +7,7 @@ import "@christopherpickering/react-leaflet-markercluster/dist/styles.min.css";
|
||||
import MarkerBar from "./MarkerBar";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
|
||||
export default function MapComponent(props) {
|
||||
export default function MapComponent(props: any) {
|
||||
const { location, listBars } = props;
|
||||
|
||||
const toast = useToast({ position: "top" });
|
||||
|
||||
+2
-9
@@ -18,13 +18,6 @@ export default function Map() {
|
||||
const idSaveToast = "saved_location";
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
//faire un useQuery pour récupérer les bars et restaurants et en meme temps regarder si l'user a une location
|
||||
//Si oui, faire une mutation avec navigator.geolocation.getCurrentPosition pour mettre à jour la location de l'user dans la bdd
|
||||
|
||||
// cet url : https://data.opendatasoft.com/api/v2/catalog/datasets/osm-fr-bars%40babel/records?limit=100&offset=0&lang=fr&timezone=UTC
|
||||
|
||||
// ou : https://data.opendatasoft.com/api/v2/catalog/datasets/osm-fr-bars%40babel/exports/json?limit=-1&offset=0&lang=fr&timezone=UTC MAIS RENVOI UN file
|
||||
|
||||
const {
|
||||
isLoading,
|
||||
isError,
|
||||
@@ -79,7 +72,6 @@ export default function Map() {
|
||||
|
||||
const userSetLocation = useMutation({
|
||||
mutationKey: "userSetLocation",
|
||||
enabled: !isLoading && !loggedUser,
|
||||
mutationFn: async (position: string) => {
|
||||
const pos = {
|
||||
location: position,
|
||||
@@ -112,11 +104,12 @@ export default function Map() {
|
||||
useEffect(() => {
|
||||
navigator.geolocation.getCurrentPosition((position) => {
|
||||
setLocation([position.coords.latitude, position.coords.longitude]);
|
||||
if (!loggedUser) return;
|
||||
userSetLocation.mutate(
|
||||
`${position.coords.latitude},${position.coords.longitude}`
|
||||
);
|
||||
});
|
||||
}, []);
|
||||
}, [loggedUser]);
|
||||
|
||||
const MapWithNoSSR = dynamic(
|
||||
() => import("../components/layout/map/MapComponent"),
|
||||
|
||||
+17
-17
@@ -362,23 +362,6 @@ export default function UserProfile() {
|
||||
</FormControl>
|
||||
</Box>
|
||||
<Divider colorScheme={"purple"} />
|
||||
<Box my={"1rem"}>
|
||||
<Box>
|
||||
<FormLabel as={"legend"} htmlFor={"passion"}>
|
||||
Centre d'intéret :
|
||||
</FormLabel>
|
||||
<VStack gap={"1rem"} align="start">
|
||||
<ProfileTagList
|
||||
userPassions={
|
||||
userData.PassionID !== undefined ? userData.PassionID : []
|
||||
}
|
||||
passions={passions}
|
||||
/>
|
||||
<ModalChoosePassion user={userData} passions={passions} />
|
||||
</VStack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Divider colorScheme={"purple"} />
|
||||
<Box my={"1rem"}>
|
||||
<Box>
|
||||
<FormLabel as={"legend"} htmlFor={"gender"}>
|
||||
@@ -419,6 +402,23 @@ export default function UserProfile() {
|
||||
</Box>
|
||||
</Box>
|
||||
<Divider colorScheme={"purple"} />
|
||||
<Box my={"1rem"}>
|
||||
<Box>
|
||||
<FormLabel as={"legend"} htmlFor={"passion"}>
|
||||
Centre d'intéret :
|
||||
</FormLabel>
|
||||
<VStack gap={"1rem"} align="start">
|
||||
<ProfileTagList
|
||||
userPassions={
|
||||
userData.PassionID !== undefined ? userData.PassionID : []
|
||||
}
|
||||
passions={passions}
|
||||
/>
|
||||
<ModalChoosePassion user={userData} passions={passions} />
|
||||
</VStack>
|
||||
</Box>
|
||||
</Box>
|
||||
<Divider colorScheme={"purple"} />
|
||||
<Box my={"1rem"}>
|
||||
<Center>
|
||||
<Text as={"b"} fontSize={"1.5rem"} my={"1rem"}>
|
||||
|
||||
Reference in New Issue
Block a user