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
bora-it
Commits
744660e7
Commit
744660e7
authored
Aug 02, 2021
by
seoyeon
Browse files
useRef
parent
529e50de
Changes
2
Hide whitespace changes
Inline
Side-by-side
client/src/components/Login.js
View file @
744660e7
import
{
useEffect
,
useState
}
from
'
react
'
import
{
useEffect
,
useState
,
useRef
}
from
'
react
'
import
{
Redirect
}
from
'
react-router-dom
'
import
{
Redirect
}
from
'
react-router-dom
'
import
userApi
from
'
../apis/user.api
'
import
userApi
from
'
../apis/user.api
'
import
catchErrors
from
"
../context/catchError
"
;
import
catchErrors
from
'
../context/catchError
'
import
{
handleLogin
}
from
'
../context/auth
'
;
import
{
handleLogin
}
from
'
../context/auth
'
const
INIT_USER
=
{
const
INIT_USER
=
{
email
:
''
,
email
:
''
,
password
:
''
,
password
:
''
,
}
}
const
Login
=
()
=>
{
const
Login
=
()
=>
{
// const { loading, login, catchErrorAuth } = useAuth()
const
[
user
,
setUser
]
=
useState
(
INIT_USER
)
const
[
user
,
setUser
]
=
useState
(
INIT_USER
)
const
[
disabled
,
setDisabled
]
=
useState
(
true
)
const
[
disabled
,
setDisabled
]
=
useState
(
true
)
const
[
error
,
setError
]
=
useState
(
''
)
const
[
error
,
setError
]
=
useState
(
''
)
const
[
success
,
setSuccess
]
=
useState
(
false
)
const
[
success
,
setSuccess
]
=
useState
(
false
)
// const [modalopen, setmodalOpen] = useState(false)
// const loginref = useRef()
useEffect
(()
=>
{
useEffect
(()
=>
{
const
isUser
=
Object
.
values
(
user
).
every
((
el
)
=>
Boolean
(
el
))
const
isUser
=
Object
.
values
(
user
).
every
((
el
)
=>
Boolean
(
el
))
isUser
?
setDisabled
(
false
)
:
setDisabled
(
true
)
isUser
?
setDisabled
(
false
)
:
setDisabled
(
true
)
// window.addEventListener('click', handleModal)
// return () => {
// window.removeEventListener('click', handleModal)
// }
},
[
user
])
},
[
user
])
function
handleChange
(
event
)
{
function
handleChange
(
event
)
{
...
@@ -25,6 +30,14 @@ const Login = () => {
...
@@ -25,6 +30,14 @@ const Login = () => {
setUser
({
...
user
,
[
name
]:
value
})
setUser
({
...
user
,
[
name
]:
value
})
}
}
// const handleModal = (e) => {
// if (
// modalopen &&
// (!loginref.current || !loginref.current.contains(e.target))
// )
// setmodalOpen(false)
// }
async
function
handleSubmit
(
e
)
{
async
function
handleSubmit
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
console
.
log
(
'
로그인
'
)
console
.
log
(
'
로그인
'
)
...
@@ -51,7 +64,6 @@ const Login = () => {
...
@@ -51,7 +64,6 @@ const Login = () => {
return
(
return
(
<
div
className
=
"
modal-content
"
>
<
div
className
=
"
modal-content
"
>
{
error
&&
<
div
className
=
"
alert alert-danger
"
>
{
error
}
<
/div>
}
<
form
onSubmit
=
{
handleSubmit
}
>
<
form
onSubmit
=
{
handleSubmit
}
>
<
div
className
=
"
modal-header
"
>
<
div
className
=
"
modal-header
"
>
<
h5
className
=
"
modal-title
"
id
=
"
loginModalLabel
"
>
<
h5
className
=
"
modal-title
"
id
=
"
loginModalLabel
"
>
...
@@ -64,6 +76,7 @@ const Login = () => {
...
@@ -64,6 +76,7 @@ const Login = () => {
aria
-
label
=
"
Close
"
aria
-
label
=
"
Close
"
><
/button
>
><
/button
>
<
/div
>
<
/div
>
{
error
&&
<
div
className
=
"
alert alert-danger
"
>
{
error
}
<
/div>
}
<
div
className
=
"
modal-body
"
>
<
div
className
=
"
modal-body
"
>
<
div
>
<
div
>
<
label
>
아이디
<
/label
>
<
label
>
아이디
<
/label
>
...
...
client/src/components/Room/Controller.js
View file @
744660e7
...
@@ -2,9 +2,9 @@ import ScreenSelect from './ScreenSelect'
...
@@ -2,9 +2,9 @@ import ScreenSelect from './ScreenSelect'
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
const
Controller
=
()
=>
{
const
Controller
=
()
=>
{
const
[
mic
,
setMic
]
=
useState
(
"
true
"
)
const
[
mic
,
setMic
]
=
useState
(
true
)
const
[
speaker
,
setSpeaker
]
=
useState
(
"
true
"
)
const
[
speaker
,
setSpeaker
]
=
useState
(
true
)
const
[
video
,
setVideo
]
=
useState
(
"
true
"
)
const
[
video
,
setVideo
]
=
useState
(
true
)
const
micOn
=
(()
=>
setMic
(
false
));
const
micOn
=
(()
=>
setMic
(
false
));
const
micOff
=
(()
=>
setMic
(
true
));
const
micOff
=
(()
=>
setMic
(
true
));
...
...
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