Toggle navigation
Toggle navigation
This project
Loading...
Sign in
정민우
/
vps_service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
ch4n3.yoon
2021-05-14 16:43:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e30e705c73d508a4b863790677455d77d34f96d8
e30e705c
1 parent
3697d9d2
[Edit] Sign Up 기능 서버와 연결
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
3 deletions
frontend/src/App.js
frontend/src/components/SignUp.js
frontend/src/App.js
View file @
e30e705
...
...
@@ -3,6 +3,7 @@ import { BrowserRouter, Route, Redirect, Switch, Link } from 'react-router-dom'
import
{
ChakraProvider
}
from
'@chakra-ui/react'
import
Index
from
'./components/Index'
import
SignIn
from
'./components/SignIn'
import
SignUp
from
'./components/SignUp'
import
DockerContainerCreate
from
'./components/DockerContainerCreate'
import
DockerContainerList
from
'./components/DockerContainerList'
import
'semantic-ui-css/semantic.min.css'
...
...
@@ -14,6 +15,7 @@ const App = () => {
<
Switch
>
<
Route
exact
path
=
"/"
component
=
{
Index
}
/
>
<
Route
exact
path
=
"/sign-in"
component
=
{
SignIn
}
/
>
<
Route
exact
path
=
"/sign-up"
component
=
{
SignUp
}
/
>
<
Route
exact
path
=
"/docker/container/create"
component
=
{
DockerContainerCreate
}
/
>
<
Route
exact
path
=
"/docker/container/list"
component
=
{
DockerContainerList
}
/
>
<
Redirect
path
=
"*"
to
=
"/"
/>
...
...
frontend/src/components/SignUp.js
View file @
e30e705
...
...
@@ -6,7 +6,6 @@ import {
Button
,
Segment
,
Message
,
Divider
,
Form
,
Input
,
Transition
,
...
...
@@ -24,15 +23,33 @@ import {
InputGroup
,
InputLeftElement
,
InputRightElement
,
Alert
,
AlertIcon
,
AlertTitle
,
AlertDescription
,
AlertDialog
,
AlertDialogBody
,
AlertDialogFooter
,
AlertDialogHeader
,
AlertDialogContent
,
AlertDialogOverlay
,
}
from
'@chakra-ui/react'
import
{
PhoneIcon
}
from
'@chakra-ui/icons'
import
{
Divider
,
}
from
'semantic-ui-react'
import
http
from
'../utils/http'
const
SignUp
=
()
=>
{
const
[
username
,
setUsername
]
=
useState
(
''
)
const
[
password
,
setPassword
]
=
useState
(
''
)
const
[
name
,
setName
]
=
useState
(
''
)
const
[
email
,
setEmail
]
=
useState
(
''
)
const
[
phone
,
setPhone
]
=
useState
(
''
)
const
[
isSuccess
,
setSuccess
]
=
useState
(
false
)
const
cancelRef
=
React
.
useRef
()
const
onClose
=
()
=>
setSuccess
(
false
)
const
handleUsernameOnChange
=
(
event
)
=>
{
setUsername
(
event
.
target
.
value
)
...
...
@@ -42,6 +59,10 @@ const SignUp = () => {
setPassword
(
event
.
target
.
value
)
}
const
handleNameOnChange
=
(
event
)
=>
{
setName
(
event
.
target
.
value
)
}
const
handlePhoneOnChange
=
(
event
)
=>
{
setPhone
(
event
.
target
.
value
)
}
...
...
@@ -50,13 +71,32 @@ const SignUp = () => {
setEmail
(
event
.
target
.
value
)
}
const
signUp
=
()
=>
{
http
.
post
(
'/user/register'
,
{
userId
:
username
,
password
:
password
,
// eslint-disable-next-line no-restricted-globals
name
:
name
,
phone
:
phone
,
email
:
email
,
}).
then
(
response
=>
{
const
{
success
,
code
,
message
,
data
}
=
response
.
data
if
(
success
)
{
setSuccess
(
true
)
}
}).
catch
(
error
=>
{
console
.
error
(
error
)
})
}
useEffect
(()
=>
{
},
[])
return
(
<
Container
>
<
Divider
hidden
/>
<
Heading
>
Sign
-
Up
<
/Heading>
<
br
/>
<
br
/>
<
Stack
// divider={<StackDivider borderColor="gray.200"/>}
...
...
@@ -90,10 +130,17 @@ const SignUp = () => {
/>
<
Input
type
=
"text"
placeholder
=
"Enter your name"
value
=
{
name
}
onChange
=
{
handleNameOnChange
}
/>
<
InputGroup
>
<
InputLeftElement
pointerEvents
=
"none"
children
=
{
<
PhoneIcon
color
=
"gray.300"
/>
}
children
=
{
<
PhoneIcon
color
=
"gray.300"
/>
}
/>
<
Input
type
=
"tel"
...
...
@@ -105,10 +152,26 @@ const SignUp = () => {
<
Button
colorScheme
=
"teal"
onClick
=
{()
=>
signUp
()}
>
Sign
Up
<
/Button>
<
/Stack>
<
AlertDialog
isOpen
=
{
isSuccess
}
leastDestructiveRef
=
{
cancelRef
}
onClose
=
{
onClose
}
>
<
AlertDialogOverlay
>
<
AlertDialogContent
>
<
Alert
status
=
"success"
>
<
AlertIcon
/>
Successfully
signed
up
!
<
/Alert>
<
/AlertDialogContent>
<
/AlertDialogOverlay>
<
/AlertDialog>
<
/Container>
)
}
...
...
Please
register
or
login
to post a comment