|
|
@ -7,41 +7,27 @@ import './Profile.css'
|
|
|
|
import SessionService from '../services/SessionService';
|
|
|
|
import SessionService from '../services/SessionService';
|
|
|
|
import { PlayerProps } from '../types/Player';
|
|
|
|
import { PlayerProps } from '../types/Player';
|
|
|
|
import { update } from 'lodash';
|
|
|
|
import { update } from 'lodash';
|
|
|
|
import Human from '../model/Human';
|
|
|
|
import User from '../model/User';
|
|
|
|
|
|
|
|
import { socket } from '../SocketConfig';
|
|
|
|
|
|
|
|
import { useAuth } from '../Contexts/AuthContext';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//@ts-ignore
|
|
|
|
//@ts-ignore
|
|
|
|
const Profile = () => {
|
|
|
|
const Profile = () => {
|
|
|
|
|
|
|
|
|
|
|
|
//let player;
|
|
|
|
//let player;
|
|
|
|
const [player, setPlayer] = useState<Human>(new Human("null", "nullHuman"));
|
|
|
|
const {user} = useAuth()
|
|
|
|
|
|
|
|
|
|
|
|
//! useeffect pour l'instant, il faudra voir pour changer la facons de prendre une session
|
|
|
|
//! useeffect pour l'instant, il faudra voir pour changer la facons de prendre une session
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
const fetchUserInformation = async () => {
|
|
|
|
console.log(user)
|
|
|
|
try {
|
|
|
|
}, [user])
|
|
|
|
const sessionData = await SessionService.getSession();
|
|
|
|
|
|
|
|
if (sessionData.user) {
|
|
|
|
|
|
|
|
const updatedPlayer: Human = {
|
|
|
|
|
|
|
|
name: sessionData.user.pseudo,
|
|
|
|
|
|
|
|
pdp: sessionData.user.profilePicture,
|
|
|
|
|
|
|
|
toJson: function (): { type: string; id: string; name: string; } {
|
|
|
|
|
|
|
|
throw new Error('Function not implemented.');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
id: ''
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
setPlayer(updatedPlayer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchUserInformation();
|
|
|
|
|
|
|
|
}, []
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className='mainContainer'>
|
|
|
|
<div className='mainContainer'>
|
|
|
|
<ProfilePDP player={player}/>
|
|
|
|
<ProfilePDP player={user}/>
|
|
|
|
<h1> {player.name} </h1>
|
|
|
|
<h1> {user?.pseudo} </h1>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|