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
eue
Commits
96424de4
Commit
96424de4
authored
Jul 31, 2021
by
KangMin An
Browse files
Update: 에어컨 사용 여부 처리 코드 개선. 프론트 시계에러 처리.
parent
1e5a8949
Changes
4
Show whitespace changes
Inline
Side-by-side
client/src/components/TimeNow.js
View file @
96424de4
import
React
from
'
react
'
;
import
React
from
"
react
"
;
import
{
Row
,
Card
}
from
'
react-bootstrap
'
;
import
{
Row
,
Card
}
from
"
react-bootstrap
"
;
import
Clock
from
'
react-live-clock
'
import
Clock
from
"
react-live-clock
"
;
import
'
../App.css
'
import
"
../App.css
"
;
function
TimeNow
()
{
function
TimeNow
()
{
const
cardstyled
=
{
const
cardstyled
=
{
margin
:
'
auto
'
,
margin
:
"
auto
"
,
padding
:
'
1em
'
,
padding
:
"
1em
"
,
display
:
'
flex
'
,
display
:
"
flex
"
,
justifyContent
:
'
center
'
,
justifyContent
:
"
center
"
,
width
:
'
100%
'
,
width
:
"
100%
"
,
borderWidth
:
'
3px
'
,
borderWidth
:
"
3px
"
,
borderRadius
:
'
20px
'
,
borderRadius
:
"
20px
"
,
borderColor
:
'
rgb(110, 189, 142)
'
,
borderColor
:
"
rgb(110, 189, 142)
"
,
color
:
'
#04AB70
'
color
:
"
#04AB70
"
,
}
}
;
return
(
return
(
<
Row
className
=
'
text-center w-100 my-2
'
>
<
Row
className
=
"
text-center w-100 my-2
"
>
<
Card
style
=
{
cardstyled
}
>
<
Card
style
=
{
cardstyled
}
>
<
Card
.
Title
>
<
Card
.
Title
>
<
p
>
<
p
>
현재시각
<
/p
>
현재시각
<
/p
>
<
/Card.Title
>
<
/Card.Title
>
<
Card
.
Text
>
<
Card
.
Text
>
<
Clock
format
=
{
'
Y년 M월 D일
'
}
/
>
<
Clock
format
=
{
"
Y년 M월 D일
"
}
/
>
<
br
/>
<
br
/>
<
Clock
format
=
{
'
HH : mm : ss
'
}
ticking
=
{
true
}
timezone
=
{
"
KR
"
}
/
>
<
Clock
format
=
{
"
HH : mm : ss
"
}
ticking
=
{
true
}
timezone
=
{
"
Asia/Seoul
"
}
/
>
<
/Card.Text
>
<
/Card.Text
>
<
/Card
>
<
/Card
>
<
/Row
>
<
/Row
>
)
)
;
}
}
export
default
TimeNow
;
export
default
TimeNow
;
client/src/components/UsingAircon.js
View file @
96424de4
...
@@ -2,11 +2,10 @@ import axios from "axios";
...
@@ -2,11 +2,10 @@ import axios from "axios";
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
Form
}
from
"
react-bootstrap
"
;
import
{
Form
}
from
"
react-bootstrap
"
;
import
{
callUserInfo
,
checkCookies
}
from
"
../utils/CheckDB
"
;
import
{
callUserInfo
,
checkCookies
}
from
"
../utils/CheckDB
"
;
import
{
isLogined
}
from
'
./../utils/Auth
'
;
import
{
isLogined
}
from
"
./../utils/Auth
"
;
function
UsingAircon
()
{
function
UsingAircon
()
{
const
[
airUsing
,
setAirUsing
]
=
useState
(
false
);
const
[
airUsing
,
setAirUsing
]
=
useState
(
false
)
// useEffect(() => {
// useEffect(() => {
// callUserInfo().then((res) => {
// callUserInfo().then((res) => {
...
@@ -20,34 +19,36 @@ function UsingAircon() {
...
@@ -20,34 +19,36 @@ function UsingAircon() {
// }, [checkCookies()])
// }, [checkCookies()])
function
airChange
()
{
function
airChange
()
{
setAirUsing
(
!
airUsing
)
setAirUsing
(
!
airUsing
)
;
async
function
Useair
()
{
async
function
Useair
()
{
const
res
=
await
axios
.
pos
t
(
'
/api/
edit-profile
'
,
{
using_aircon
:
!
airUsing
})
const
res
=
await
axios
.
ge
t
(
"
/api/
toggle-aircon
"
);
console
.
log
(
res
)
console
.
log
(
res
)
;
}
}
Useair
()
Useair
()
;
}
}
console
.
log
(
"
airUsing
"
,
airUsing
);
console
.
log
(
'
airUsing
'
,
airUsing
)
return
(
return
(
<>
<>
{
isLogined
()
&&
{
isLogined
()
&&
(
<
Form
<
Form
key
=
'
checkbox
'
className
=
"
d-flex justify-content-center w-100
"
style
=
{{
flexDirection
:
'
row-reverse
'
}}
>
key
=
"
checkbox
"
className
=
"
d-flex justify-content-center w-100
"
style
=
{{
flexDirection
:
"
row-reverse
"
}}
>
<
Form
.
Check
<
Form
.
Check
type
=
'
switch
'
type
=
"
switch
"
id
=
'
airconditioner
'
id
=
"
airconditioner
"
label
=
'
에어컨 사용중
'
label
=
"
에어컨 사용중
"
onChange
=
{
airChange
}
onChange
=
{
airChange
}
checked
=
{
airUsing
}
checked
=
{
airUsing
}
/
>
/
>
<
/Form
>
<
/Form
>
}
)
}
<
/
>
<
/
>
)
)
;
}
}
export
default
UsingAircon
;
export
default
UsingAircon
;
server/API명세서.md
View file @
96424de4
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
| Auth | GET | /confirm?... | 메일 인증용 토큰의 유효성 확인 요청 |
| Auth | GET | /confirm?... | 메일 인증용 토큰의 유효성 확인 요청 |
| User Info | GET | /user-info | 회원 정보 요청 |
| User Info | GET | /user-info | 회원 정보 요청 |
| User Info | POST | /edit-profile | 회원 정보 수정 요청 |
| User Info | POST | /edit-profile | 회원 정보 수정 요청 |
| User Info | GET | /toggle-aircon | 회원의 에어컨 사용 여부 정보 수정 요청 |
<br><br>
<br><br>
...
@@ -186,3 +187,8 @@
...
@@ -186,3 +187,8 @@
1.
로그아웃 요청 주소 생성
1.
로그아웃 요청 주소 생성
: 로그아웃 요청 시 클라이언트의 쿠키에 저장된 토큰을 없애도록 처리.
: 로그아웃 요청 시 클라이언트의 쿠키에 저장된 토큰을 없애도록 처리.
### 2021.07.31 \_ 에어컨 사용
1.
에어컨 사용 토글 버튼 처리 주소 생성
: 사용자의 에어컨 사용 여부 변환 처리.
server/src/routers/globalRouter.js
View file @
96424de4
...
@@ -32,6 +32,6 @@ globalRouter.get(routes.confirm, getConfirm);
...
@@ -32,6 +32,6 @@ globalRouter.get(routes.confirm, getConfirm);
// User Info
// User Info
globalRouter
.
get
(
routes
.
userinfo
,
onlyPrivate
,
getUserInfo
);
globalRouter
.
get
(
routes
.
userinfo
,
onlyPrivate
,
getUserInfo
);
globalRouter
.
post
(
routes
.
editProfile
,
onlyPrivate
,
postEditProfile
);
globalRouter
.
post
(
routes
.
editProfile
,
onlyPrivate
,
postEditProfile
);
globalRouter
.
pos
t
(
routes
.
toggleAircon
,
onlyPrivate
,
getToggleAircon
);
globalRouter
.
ge
t
(
routes
.
toggleAircon
,
onlyPrivate
,
getToggleAircon
);
export
default
globalRouter
;
export
default
globalRouter
;
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