Commit 918ba292 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

state추가

parent eeed70d6
...@@ -6,10 +6,23 @@ import catchErrors from '../utils/catchErrors'; ...@@ -6,10 +6,23 @@ import catchErrors from '../utils/catchErrors';
function Chat(props) { function Chat(props) {
let defaultname = sessionStorage.getItem('name'); // let defaultname = sessionStorage.getItem('name');
const [inner, setInner] = useState(['']) const [inner, setInner] = useState([''])
const [chat, setChat] = useState([]) //object로 key는 보낸사람 value는 메세지 const [chat, setChat] = useState([]) //object로 key는 보낸사람 value는 메세지
const [disabled, setDisabled] = useState(true)
const [user, setUser] = useState('')
const [error, setError] = useState('');
const userId = isAuthenticated()
async function getProfile(userId) {
try {
const response = await axios.get(`/users/${userId}`)
setUser(response.data)
} catch (error) {
catchErrors(error, setError)
}
}
function handleChange(e) { function handleChange(e) {
e.preventDefault() e.preventDefault()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment