diff --git a/Back-end/src/main/java/com/example/starter/QueryUsers.java b/Back-end/src/main/java/com/example/starter/QueryUsers.java index be4dae7..792f575 100644 --- a/Back-end/src/main/java/com/example/starter/QueryUsers.java +++ b/Back-end/src/main/java/com/example/starter/QueryUsers.java @@ -109,7 +109,7 @@ public class QueryUsers { .end(new JsonObject().put("error", "Corps de la requête manquant").encode()); return; } - Integer idUser = body.getInteger("idUser"); + Integer idUser = body.getInteger("id"); databaseService.pool .preparedQuery("SELECT * FROM users WHERE id=?;") .execute(Tuple.of(idUser)) diff --git a/Front-end/src/components/UserInfosObject.jsx b/Front-end/src/components/UserInfosObject.jsx index f26f051..0ea3c13 100644 --- a/Front-end/src/components/UserInfosObject.jsx +++ b/Front-end/src/components/UserInfosObject.jsx @@ -1,58 +1,47 @@ -import React from "react"; -import { Info } from "lucide-react"; +import React,{useEffect, useState} from "react"; +import { User } from "lucide-react"; import axios from "axios"; import { API_BASE_URL } from "../config"; -function UserInfosObject({ object,defafficherModif }) { - axios +function UserInfosObject({ user}) { + const [userInfo,setuserInfo]=useState({}); + useEffect(()=>{ + console.log(user); + axios .post(`${API_BASE_URL}/publicUser`, { - id: object.user, + id: user, }) .then((response) => { + setuserInfo(response.data); console.log("Modification réussie :", response.data); }) .catch((error) => { console.error("Erreur lors de la modification :", error); }); - defafficherModif(false); - window.location.reload(); + },[user]); + return ( -
+
- +
-

Informations

+

Propriétaire

-

Description :

-

{object.description}

+

Pseudo :

+

{userInfo.pseudo}

-

Type :

-

{object.type}

+

Genre :

+

{userInfo.gender}

-

Localisation :

-

{object.location}

-
- -
-

Status :

-

{object.status}

-
- -
-

- Derniere mise à jour : -

-

{object.last_update}

-
-
- defafficherModif(true))}>Modifier ces infos +

Nombre de points :

+

{userInfo.points}

); diff --git a/Front-end/src/pages/Gestion/Objet.jsx b/Front-end/src/pages/Gestion/Objet.jsx index 2d484bd..7b76169 100644 --- a/Front-end/src/pages/Gestion/Objet.jsx +++ b/Front-end/src/pages/Gestion/Objet.jsx @@ -13,6 +13,7 @@ import MeteoInfos from "../../components/MeteoInfos"; import MeteoGraph from "../../components/MeteoGraph"; import BatterieInfo from "../../components/BatterieInfo"; import { useAuth } from "../../AuthContext"; +import UserInfosObject from "../../components/UserInfosObject"; function Objet() { const {user} =useAuth(); const identifiant = new URLSearchParams(window.location.search).get("id"); @@ -71,6 +72,8 @@ function Objet() { graphRefs={graphRefs} /> + +
{graphStates.wind && }