51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
import React,{useEffect, useState} from "react";
|
|
import { User } from "lucide-react";
|
|
import axios from "axios";
|
|
import { API_BASE_URL } from "../config";
|
|
|
|
|
|
function UserInfosObject({ user}) {
|
|
const [userInfo,setuserInfo]=useState({});
|
|
useEffect(()=>{
|
|
console.log(user);
|
|
axios
|
|
.post(`${API_BASE_URL}/publicUser`, {
|
|
id: user,
|
|
})
|
|
.then((response) => {
|
|
setuserInfo(response.data);
|
|
console.log("Modification réussie :", response.data);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Erreur lors de la modification :", error);
|
|
});
|
|
},[user]);
|
|
|
|
return (
|
|
<div className="bg-white p-6 rounded-xl min-w-5xl">
|
|
<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">
|
|
<User className="text-indigo-600" size={24} />
|
|
</div>
|
|
<h1 className="text-black text-2xl font-bold mb-1 ">Propriétaire</h1>
|
|
</div>
|
|
<div className="mb-5">
|
|
<p className="text-black-900 font-bold">Pseudo :</p>
|
|
<p className="text-gray-600 capitalize">{userInfo.pseudo}</p>
|
|
</div>
|
|
|
|
<div className="mb-5">
|
|
<p className="text-black-900 font-bold">Genre :</p>
|
|
<p className="text-gray-600 capitalize">{userInfo.gender}</p>
|
|
</div>
|
|
|
|
<div className="mb-5">
|
|
<p className="text-black-900 font-bold">Nombre de points :</p>
|
|
<p className="text-gray-600">{userInfo.points}</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default UserInfosObject;
|