Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오인제
/
Tunnel
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
고병후
2021-12-06 02:58:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
266e2f97d682d9ca4a7278cb0cb5309de26143bd
266e2f97
1 parent
39cb7f51
Remove error
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
84 deletions
tunnel_BE/server/obj/user.json
tunnel_BE/server/routes/register.js
turnel_FE/src/_actions/types.js
turnel_FE/src/_actions/user_action.js
turnel_FE/src/_reducers/index.js
turnel_FE/src/_reducers/user_reducer.js
turnel_FE/src/component/views/LoginPage/LoginPage.js
turnel_FE/src/component/views/RegisterPage/RegisterPage.js
turnel_FE/src/index.js
tunnel_BE/server/obj/user.json
View file @
266e2f9
{
"id"
:
"3"
"id"
:
1
}
\ No newline at end of file
...
...
tunnel_BE/server/routes/register.js
View file @
266e2f9
...
...
@@ -4,6 +4,9 @@ const router = express.Router();
router
.
post
(
'/'
,(
req
,
res
)
=>
{
console
.
log
(
req
.
body
);
return
res
.
status
(
200
).
json
({
success
:
true
});
});
router
.
get
(
'/'
,(
req
,
res
)
=>
{
...
...
turnel_FE/src/_actions/types.js
deleted
100644 → 0
View file @
39cb7f5
export
const
LOGIN_USER
=
"login_user"
;
export
const
REGISTER_USER
=
"register_user"
;
\ No newline at end of file
turnel_FE/src/_actions/user_action.js
deleted
100644 → 0
View file @
39cb7f5
import
Axios
from
'axios'
;
import
{
LOGIN_USER
,
REGISTER_USER
}
from
'./types'
;
export
function
loginUser
(
dataToSubmit
)
{
const
request
=
Axios
.
post
(
'/api/login'
,
dataToSubmit
)
.
then
(
response
=>
response
.
data
)
return
{
type
:
LOGIN_USER
,
payload
:
request
}
}
export
function
registerUser
(
dataToSubmit
)
{
const
request
=
Axios
.
post
(
'/api/register'
,
dataToSubmit
)
.
then
(
response
=>
response
.
data
)
return
{
type
:
REGISTER_USER
,
payload
:
request
}
}
\ No newline at end of file
turnel_FE/src/_reducers/index.js
deleted
100644 → 0
View file @
39cb7f5
import
{
combineReducers
}
from
'redux'
;
import
user
from
'./user_reducer'
;
const
rootReducer
=
combineReducers
({
user
})
export
default
rootReducer
;
turnel_FE/src/_reducers/user_reducer.js
deleted
100644 → 0
View file @
39cb7f5
import
{
LOGIN_USER
,
REGISTER_USER
}
from
'../_actions/types'
;
export
default
function
(
state
=
{},
action
)
{
switch
(
action
.
type
)
{
case
LOGIN_USER
:
return
{
...
state
,
loginSuccess
:
action
.
payload
}
break
;
case
REGISTER_USER
:
return
{...
state
,
register
:
action
.
payload
}
break
;
default
:
return
state
;
}
}
\ No newline at end of file
turnel_FE/src/component/views/LoginPage/LoginPage.js
View file @
266e2f9
...
...
@@ -2,11 +2,8 @@ import React, {useState} from "react";
import
"../style/LoginPage.scss"
;
import
{
Icon
,
Input
}
from
"semantic-ui-react"
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
useDispatch
}
from
"react-redux"
;
import
{
loginUser
}
from
'../../../_actions/user_action'
function
LoginPage
(
props
)
{
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
();
const
[
Id
,
setId
]
=
useState
(
""
);
...
...
@@ -26,15 +23,7 @@ function LoginPage(props) {
email
:
Id
,
password
:
Password
}
dispatch
(
loginUser
(
body
))
.
then
(
response
=>
{
if
(
response
.
payload
.
loginSuccess
)
{
props
.
history
.
push
(
'/main'
)
}
else
{
alert
(
'Error'
)
}
})
};
...
...
turnel_FE/src/component/views/RegisterPage/RegisterPage.js
View file @
266e2f9
import
React
,
{
useState
}
from
"react"
;
import
"../style/RegisterPage.scss"
;
import
{
Button
,
Icon
,
Input
}
from
"semantic-ui-react"
;
import
{
useDispatch
}
from
"react-redux"
;
import
{
registerUser
}
from
'../../../_actions/user_action'
import
Axios
from
'axios'
function
RegisterPage
(
props
)
{
const
dispatch
=
useDispatch
();
function
RegisterPage
()
{
const
[
Id
,
setId
]
=
useState
(
""
);
const
[
Password
,
setPassword
]
=
useState
(
""
);
const
[
PasswordCheck
,
setPasswordCheck
]
=
useState
(
""
);
...
...
@@ -37,14 +35,7 @@ function RegisterPage(props) {
password
:
Password
,
personality
:
Personality
}
dispatch
(
registerUser
(
body
))
.
then
(
response
=>
{
if
(
response
.
payload
.
success
)
{
props
.
history
.
push
(
'/login'
)
}
else
{
alert
(
'Failed to sign up'
)
}
})
}
return
(
<
div
id
=
"Register"
>
...
...
turnel_FE/src/index.js
View file @
266e2f9
...
...
@@ -4,19 +4,11 @@ import {Provider} from "react-redux";
import
'./index.css'
;
import
App
from
'./App'
;
import
'semantic-ui-css/semantic.min.css'
import
{
applyMiddleware
,
createStore
}
from
"redux"
;
import
promiseMiddleware
from
'redux-promise-middleware'
import
ReduxThunk
from
'redux-thunk'
import
Reducer
from
'./_reducers'
;
const
createStoreWithMiddleWare
=
applyMiddleware
(
promiseMiddleware
,
ReduxThunk
)(
createStore
)
ReactDOM
.
render
(
<
Provider
store
=
{
createStoreWithMiddleWare
(
Reducer
,
window
.
__REDUX_DEVTOOLS_EXTENSION__
&&
window
.
__REDUX_DEVTOOLS_EXTENSION__
()
)}
>
<
App
/>
<
/Provider>
,
<
App
/>
,
document
.
getElementById
(
'root'
)
);
...
...
Please
register
or
login
to post a comment