Ajout de l'information du propriétaire de l'objet
This commit is contained in:
parent
acfebdaf0f
commit
41e8ed63dc
@ -109,7 +109,7 @@ public class QueryUsers {
|
|||||||
.end(new JsonObject().put("error", "Corps de la requête manquant").encode());
|
.end(new JsonObject().put("error", "Corps de la requête manquant").encode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Integer idUser = body.getInteger("idUser");
|
Integer idUser = body.getInteger("id");
|
||||||
databaseService.pool
|
databaseService.pool
|
||||||
.preparedQuery("SELECT * FROM users WHERE id=?;")
|
.preparedQuery("SELECT * FROM users WHERE id=?;")
|
||||||
.execute(Tuple.of(idUser))
|
.execute(Tuple.of(idUser))
|
||||||
|
|||||||
@ -1,58 +1,47 @@
|
|||||||
import React from "react";
|
import React,{useEffect, useState} from "react";
|
||||||
import { Info } from "lucide-react";
|
import { User } from "lucide-react";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { API_BASE_URL } from "../config";
|
import { API_BASE_URL } from "../config";
|
||||||
|
|
||||||
|
|
||||||
function UserInfosObject({ object,defafficherModif }) {
|
function UserInfosObject({ user}) {
|
||||||
|
const [userInfo,setuserInfo]=useState({});
|
||||||
|
useEffect(()=>{
|
||||||
|
console.log(user);
|
||||||
axios
|
axios
|
||||||
.post(`${API_BASE_URL}/publicUser`, {
|
.post(`${API_BASE_URL}/publicUser`, {
|
||||||
id: object.user,
|
id: user,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
setuserInfo(response.data);
|
||||||
console.log("Modification réussie :", response.data);
|
console.log("Modification réussie :", response.data);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Erreur lors de la modification :", error);
|
console.error("Erreur lors de la modification :", error);
|
||||||
});
|
});
|
||||||
defafficherModif(false);
|
},[user]);
|
||||||
window.location.reload();
|
|
||||||
return (
|
return (
|
||||||
<div key={object.id} className="bg-white p-6 rounded-xl min-w-5xl">
|
<div className="bg-white p-6 rounded-xl min-w-5xl">
|
||||||
<div className="flex align-items gap-6 mb-6">
|
<div className="flex align-items gap-6 mb-6">
|
||||||
<div className="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mb-1">
|
<div className="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mb-1">
|
||||||
<Info className="text-indigo-600" size={24} />
|
<User className="text-indigo-600" size={24} />
|
||||||
</div>
|
</div>
|
||||||
<h1 className="text-black text-2xl font-bold mb-1 ">Informations</h1>
|
<h1 className="text-black text-2xl font-bold mb-1 ">Propriétaire</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-5">
|
<div className="mb-5">
|
||||||
<p className="text-black-900 font-bold">Description :</p>
|
<p className="text-black-900 font-bold">Pseudo :</p>
|
||||||
<p className="text-gray-600 capitalize">{object.description}</p>
|
<p className="text-gray-600 capitalize">{userInfo.pseudo}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-5">
|
<div className="mb-5">
|
||||||
<p className="text-black-900 font-bold">Type :</p>
|
<p className="text-black-900 font-bold">Genre :</p>
|
||||||
<p className="text-gray-600 capitalize">{object.type}</p>
|
<p className="text-gray-600 capitalize">{userInfo.gender}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-5">
|
<div className="mb-5">
|
||||||
<p className="text-black-900 font-bold">Localisation :</p>
|
<p className="text-black-900 font-bold">Nombre de points :</p>
|
||||||
<p className="text-gray-600">{object.location}</p>
|
<p className="text-gray-600">{userInfo.points}</p>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mb-5">
|
|
||||||
<p className="text-black-900 font-bold">Status :</p>
|
|
||||||
<p className="text-gray-600 capitalize">{object.status}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mb-5">
|
|
||||||
<p className="text-black-900 font-bold">
|
|
||||||
Derniere mise à jour :
|
|
||||||
</p>
|
|
||||||
<p className="text-gray-600">{object.last_update}</p>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-4 mb-1">
|
|
||||||
<a className="text-blue-500 hover:cursor-pointer" onClick={(()=>defafficherModif(true))}>Modifier ces infos</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import MeteoInfos from "../../components/MeteoInfos";
|
|||||||
import MeteoGraph from "../../components/MeteoGraph";
|
import MeteoGraph from "../../components/MeteoGraph";
|
||||||
import BatterieInfo from "../../components/BatterieInfo";
|
import BatterieInfo from "../../components/BatterieInfo";
|
||||||
import { useAuth } from "../../AuthContext";
|
import { useAuth } from "../../AuthContext";
|
||||||
|
import UserInfosObject from "../../components/UserInfosObject";
|
||||||
function Objet() {
|
function Objet() {
|
||||||
const {user} =useAuth();
|
const {user} =useAuth();
|
||||||
const identifiant = new URLSearchParams(window.location.search).get("id");
|
const identifiant = new URLSearchParams(window.location.search).get("id");
|
||||||
@ -71,6 +72,8 @@ function Objet() {
|
|||||||
graphRefs={graphRefs}
|
graphRefs={graphRefs}
|
||||||
/>
|
/>
|
||||||
<BatterieInfo object={object} />
|
<BatterieInfo object={object} />
|
||||||
|
<UserInfosObject user={object.proprio_id}/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{graphStates.wind && <WindGraph object={object} reference={graphRefs.wind} />}
|
{graphStates.wind && <WindGraph object={object} reference={graphRefs.wind} />}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user