import React, { useState, useEffect } from 'react' import Menu from '../Components/Menu'; import { Image, Button, Container, Form, Row, Col, Dropdown } from 'react-bootstrap'; import { BrowserRouter as Link } from 'react-router-dom'; import axios from 'axios' import userdefault from '../Images/KakaoTalk_20201230_153151693.png' import img1 from '../Images/img_1.png' import img2 from '../Images/img_2.png' import img3 from '../Images/img_3.jpg' import DropdownItem from 'react-bootstrap/esm/DropdownItem'; // const INIT_USER = { // username: '', // email: '', // nickname: '' // } function ProfilePage() { const [user, setUser] = useState('') const [userimg, setUserimg] = useState(img2) const [defaultImg, setDefaultImg] = useState(true) const [hidden, setHidden] = useState(true) async function getLoginedUser() { const userid = sessionStorage.getItem('userId') const response = await axios.post(`/users/${userid}`, { '_id': userid }) setUser(response.data) } function handleSubmit(e) { e.preventDefault() if (hidden) { setHidden(false) } else { setHidden(true) } } function handleChange(e) { setUser({ ...user, 'nickname': e.target.value }) } async function handleNicksave() { const userid = sessionStorage.getItem('userId') await axios.put(`/users/${userid}`, user) } function setThumbnail(event) { //불러온 사진