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
quiz-competition
Commits
f21119fa
Commit
f21119fa
authored
Sep 30, 2020
by
Daeki Yoon
Browse files
signup 시작
parent
abd187d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/client/src/MainRouter.jsx
View file @
f21119fa
...
@@ -5,6 +5,7 @@ import Home from "./core/Home";
...
@@ -5,6 +5,7 @@ import Home from "./core/Home";
import
Menu
from
"
./core/Menu
"
;
import
Menu
from
"
./core/Menu
"
;
import
NewQuiz
from
'
./quiz/NewQuiz
'
import
NewQuiz
from
'
./quiz/NewQuiz
'
import
Quiz
from
'
./quiz/Quiz
'
import
Quiz
from
'
./quiz/Quiz
'
import
Signup
from
"
./user/Signup
"
function
MainRouter
()
{
function
MainRouter
()
{
return
(
return
(
...
@@ -18,6 +19,9 @@ function MainRouter() {
...
@@ -18,6 +19,9 @@ function MainRouter() {
<
Route
path
=
"/signin"
>
<
Route
path
=
"/signin"
>
<
Signin
/>
<
Signin
/>
</
Route
>
</
Route
>
<
Route
path
=
"/signup"
>
<
Signup
/>
</
Route
>
<
Route
path
=
'/quiz/new'
>
<
Route
path
=
'/quiz/new'
>
<
NewQuiz
/>
<
NewQuiz
/>
</
Route
>
</
Route
>
...
...
src/client/src/core/Menu.jsx
View file @
f21119fa
import
React
from
"
react
"
;
import
React
from
"
react
"
import
Navbar
from
"
react-bootstrap/Navbar
"
;
import
Navbar
from
"
react-bootstrap/Navbar
"
import
Nav
from
"
react-bootstrap/Nav
"
;
import
Nav
from
"
react-bootstrap/Nav
"
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
;
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
import
Button
from
"
react-bootstrap/Button
"
;
import
Button
from
"
react-bootstrap/Button
"
import
auth
from
"
../auth/auth-helpers
"
;
import
auth
from
"
../auth/auth-helpers
"
import
{
Link
,
useHistory
}
from
"
react-router-dom
"
;
import
{
Link
,
useHistory
}
from
"
react-router-dom
"
import
{
useAuth
}
from
"
../auth/auth-context
"
;
import
{
useAuth
}
from
"
../auth/auth-context
"
function
Menu
()
{
function
Menu
()
{
const
{
authUser
,
setAuthUser
}
=
useAuth
()
const
{
authUser
,
setAuthUser
}
=
useAuth
()
const
history
=
useHistory
()
;
const
history
=
useHistory
()
return
(
return
(
<
Navbar
sticky
=
"top"
bg
=
"dark"
variant
=
"dark"
expand
=
"sm"
>
<
Navbar
sticky
=
"top"
bg
=
"dark"
variant
=
"dark"
expand
=
"sm"
>
...
@@ -37,21 +37,26 @@ function Menu() {
...
@@ -37,21 +37,26 @@ function Menu() {
<
Button
<
Button
onClick
=
{
()
=>
onClick
=
{
()
=>
auth
.
clearJwt
(()
=>
{
auth
.
clearJwt
(()
=>
{
history
.
push
(
"
/
"
)
;
history
.
push
(
"
/
"
)
setAuthUser
(
false
)
;
setAuthUser
(
false
)
})
})
}
}
>
>
Sign out
Sign out
</
Button
>
</
Button
>
)
:
(
)
:
(
<
Link
to
=
"/signin"
>
<>
<
Button
>
Sign in
</
Button
>
<
Link
to
=
"/signin"
>
</
Link
>
<
Button
>
Sign in
</
Button
>
)
}
</
Link
>
<
Link
to
=
"/signup"
>
<
Button
>
Sign up
</
Button
>
</
Link
>
</>
)
}
</
Navbar
.
Collapse
>
</
Navbar
.
Collapse
>
</
Navbar
>
</
Navbar
>
)
;
)
}
}
export
default
Menu
;
export
default
Menu
src/client/src/user/Signup.jsx
0 → 100644
View file @
f21119fa
import
React
,
{
useState
}
from
'
react
'
import
Button
from
'
react-bootstrap/Button
'
import
Form
from
'
react-bootstrap/Form
'
function
Signup
()
{
const
[
values
,
setValues
]
=
useState
({
name
:
''
,
password
:
''
,
email
:
''
,
open
:
false
,
error
:
''
,
})
return
(
<
div
>
<
Form
>
<
Form
.
Group
>
<
Form
.
Label
>
Name
</
Form
.
Label
>
<
Form
.
Control
type
=
'text'
placeholder
=
'Name'
/>
</
Form
.
Group
>
<
Form
.
Group
>
<
Form
.
Label
>
Password
</
Form
.
Label
>
<
Form
.
Control
type
=
'password'
placeholder
=
'Password'
/>
</
Form
.
Group
>
<
Form
.
Group
>
<
Form
.
Label
>
Email
</
Form
.
Label
>
<
Form
.
Control
type
=
'email'
placeholder
=
'Email'
/>
</
Form
.
Group
>
<
Button
>
확인
</
Button
>
</
Form
>
</
div
>
)
}
export
default
Signup
src/client/src/user/api-user.js
0 → 100644
View file @
f21119fa
const
create
=
async
(
user
)
=>
{
try
{
const
response
=
await
fetch
(
'
/api/users/
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Accept
'
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
(
user
)
})
return
await
response
.
json
()
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
export
{
create
,
}
\ No newline at end of file
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