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
8c1c74f5
Commit
8c1c74f5
authored
Jul 28, 2021
by
Spark
Browse files
cookies component
parent
7a11adee
Changes
4
Show whitespace changes
Inline
Side-by-side
client/src/Utils/Cookies.js
0 → 100644
View file @
8c1c74f5
import
React
from
'
react
'
import
{
Swal
}
from
'
sweetalert2
'
;
export
function
checkCookies
()
{
const
acctoken_cookies
=
document
.
cookie
.
split
(
'
=
'
)[
1
];
return
acctoken_cookies
;
}
export
function
deleteCookie
(
name
)
{
document
.
cookie
=
name
+
'
=; expires=Thu, 01 Jan 1999 00:00:10 GMT;
'
;
Swal
.
fire
({
title
:
'
로그아웃 성공!
'
,
text
:
'
🙏 안녕히 가세요 🙏
'
,
icon
:
'
warning
'
,
customClass
:
'
swal-wide
'
,
confirmButtonText
:
'
확인
'
,
}).
then
((
res
)
=>
{
if
(
res
.
isConfirmed
)
{
window
.
location
.
replace
(
'
/
'
)
}
else
{
window
.
location
.
replace
(
'
/
'
)
}
})
}
\ No newline at end of file
client/src/components/MainLayer.js
View file @
8c1c74f5
...
...
@@ -6,6 +6,8 @@ import UserInfo from './UserInfo';
import
{
kakaoLogout
}
from
'
../utils/Oauth
'
;
import
axios
from
'
axios
'
;
import
{
Swal
}
from
'
sweetalert2
'
;
import
{
deleteCookie
}
from
'
../utils/Cookies
'
;
import
{
checkCookies
}
from
'
./../utils/Cookies
'
;
function
MainLayer
()
{
...
...
@@ -34,8 +36,6 @@ function MainLayer() {
color
:
'
white
'
}
const
acctoken_cookies
=
document
.
cookie
.
split
(
'
=
'
)[
1
];
// console.log(acctoken_cookies)
const
logined
=
localStorage
.
getItem
(
'
nickname
'
)
const
[
airUsing
,
setAirUsing
]
=
useState
(
false
)
...
...
@@ -55,23 +55,7 @@ function MainLayer() {
}
});
var
deleteCookie
=
function
(
name
)
{
document
.
cookie
=
name
+
'
=; expires=Thu, 01 Jan 1999 00:00:10 GMT;
'
;
Swal
.
fire
({
title
:
'
로그아웃 성공!
'
,
text
:
'
🙏 안녕히 가세요 🙏
'
,
icon
:
'
warning
'
,
customClass
:
'
swal-wide
'
,
confirmButtonText
:
'
확인
'
,
}).
then
((
res
)
=>
{
if
(
res
.
isConfirmed
)
{
window
.
location
.
replace
(
'
/
'
)
}
else
{
window
.
location
.
replace
(
'
/
'
)
}
})
}
return
(
...
...
@@ -86,7 +70,7 @@ function MainLayer() {
<
UserInfo
/>
<
/Row
>
{
acctoken_c
ookies
&&
{
checkC
ookies
()
&&
<
Form
key
=
'
checkbox
'
className
=
"
d-flex justify-content-center w-100
"
style
=
{{
flexDirection
:
'
row-reverse
'
}}
>
<
Form
.
Check
...
...
@@ -101,7 +85,7 @@ function MainLayer() {
<
Row
className
=
'
d-flex justify-content-center align-items-center my-2 mx-auto w-100
'
>
<
ButtonGroup
vertical
className
=
'
m-auto
'
style
=
{{
width
:
'
100%
'
,
flexDirection
:
'
column
'
}}
>
{
acctoken_c
ookies
?
{
checkC
ookies
()
?
//true
<
Button
variant
=
'
light
'
style
=
{
btnstyled
}
onClick
=
{
kakaoLogout
||
deleteCookie
(
'
acs_token
'
)}
>
로그아웃
...
...
@@ -114,7 +98,7 @@ function MainLayer() {
<
/Link
>
<
/Button
>
}
{
!
acctoken_c
ookies
&&
{
!
checkC
ookies
()
&&
<
Button
variant
=
'
light
'
style
=
{
btnstyled
}
>
<
Link
to
=
'
/signup
'
id
=
'
btnlink
'
>
회원가입
...
...
client/src/components/SignupComp.js
View file @
8c1c74f5
...
...
@@ -47,20 +47,6 @@ function SignupComp() {
}
console
.
log
(
'
???
'
,
formValues
)
// function CheckUserExist() {
// const signUser = localStorage.getItem('signup_username')
// const signEmail = localStorage.getItem('signup_email_Address').split('@')[1]
// if (signEmail && signUser) {
// setAlertShow(true)
// setUserExist(!userExist)
// }
// else
// if (!signEmail) {
// setAlertShow(false)
// }
// }
async
function
handleSubmit
(
event
)
{
event
.
preventDefault
();
await
axios
.
post
(
"
/api/signup
"
,
formValues
)
...
...
client/src/components/UserInfo.js
View file @
8c1c74f5
...
...
@@ -2,6 +2,7 @@ import React, { useState } from 'react'
import
{
Row
,
Card
,
Button
,
Col
,
Modal
}
from
'
react-bootstrap
'
;
import
'
../App.css
'
import
{
Link
}
from
'
react-router-dom
'
;
import
{
checkCookies
}
from
'
./../utils/Cookies
'
;
function
UserInfo
()
{
...
...
@@ -44,7 +45,7 @@ function UserInfo() {
<
Card
style
=
{
cardstyled
}
id
=
'
localName
'
>
<
Card
.
Title
>
<
strong
>
{
nickname
?
{
checkCookies
()
?
<
h2
>
{
`
${
nickname
}
`
}
<
/h2
>
...
...
@@ -76,7 +77,7 @@ function UserInfo() {
<
/p
>
}
<
/Card.Subtitle
>
{
nickname
&&
{
checkCookies
()
&&
<
Button
variant
=
'
light
'
className
=
'
m-auto d-flex
'
style
=
{
btnstyled2
}
>
<
Link
to
=
'
/edit
'
className
=
'
w-100
'
style
=
{{
textDecoration
:
'
none
'
,
color
:
'
rgb(110, 189, 142)
'
}}
>
변경
...
...
@@ -84,7 +85,7 @@ function UserInfo() {
<
/Button
>
}
<
/Row
>
{
nickname
&&
{
checkCookies
()
&&
<
p
className
=
'
w-100 justify-content-center m-auto
'
>
<
hr
/>
...
...
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