Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
918ba292
Commit
918ba292
authored
Jan 20, 2021
by
Choi Ga Young
Browse files
state추가
parent
eeed70d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
918ba292
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment