Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김건희
/
OSSW_Weather_Briefing
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
김건희
2022-05-22 16:03:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
968b2d5c4c7cec560e7d9dbd8346b4de77aaa358
968b2d5c
1 parent
065491ee
[Add] Register Redux Setting
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
11 deletions
weather_briefing/package-lock.json
weather_briefing/package.json
weather_briefing/src/component/views/RegisterPage/RegisterPage.js
weather_briefing/src/index.js
weather_briefing/src/modules/Index.js
weather_briefing/src/modules/user.js
weather_briefing/package-lock.json
View file @
968b2d5
...
...
@@ -3282,6 +3282,27 @@
"resolved"
:
"https://registry.npmjs.org/axe-core/-/axe-core-4.4.2.tgz"
,
"integrity"
:
"sha512-LVAaGp/wkkgYJcjmHsoKx4juT1aQvJyPcW09MLCjVTh3V2cc6PnyempiLMNH5iMdfIX/zdbjUx2KDjMLCTdPeA=="
},
"axios"
:
{
"version"
:
"0.27.2"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
,
"integrity"
:
"sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ=="
,
"requires"
:
{
"follow-redirects"
:
"^1.14.9"
,
"form-data"
:
"^4.0.0"
},
"dependencies"
:
{
"form-data"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
,
"integrity"
:
"sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww=="
,
"requires"
:
{
"asynckit"
:
"^0.4.0"
,
"combined-stream"
:
"^1.0.8"
,
"mime-types"
:
"^2.1.12"
}
}
}
},
"axobject-query"
:
{
"version"
:
"2.2.0"
,
"resolved"
:
"https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz"
,
...
...
@@ -10346,9 +10367,9 @@
}
},
"redux"
:
{
"version"
:
"4.
2.0
"
,
"resolved"
:
"https://registry.npmjs.org/redux/-/redux-4.
2.0
.tgz"
,
"integrity"
:
"sha512-
oSBmcKKIuIR4ME29/AeNUnl5L+hvBq7OaJWzaptTQJAntaPvxIJqfnjbaEiCzzaIz+XmVILfqAM3Ob0aXLPfjA
=="
,
"version"
:
"4.
1.2
"
,
"resolved"
:
"https://registry.npmjs.org/redux/-/redux-4.
1.2
.tgz"
,
"integrity"
:
"sha512-
SH8PglcebESbd/shgf6mii6EIoRM0zrQyjcuQ+ojmfxjTtE0z9Y8pa62iA/OJ58qjP6j27uyW4kUF4jl/jd6sw
=="
,
"requires"
:
{
"@babel/runtime"
:
"^7.9.2"
}
...
...
weather_briefing/package.json
View file @
968b2d5
...
...
@@ -6,6 +6,7 @@
"@testing-library/jest-dom"
:
"^5.16.4"
,
"@testing-library/react"
:
"^13.2.0"
,
"@testing-library/user-event"
:
"^13.5.0"
,
"axios"
:
"^0.27.2"
,
"cors"
:
"^2.8.5"
,
"express"
:
"^4.18.1"
,
"http-proxy-middleware"
:
"^2.0.6"
,
...
...
@@ -16,7 +17,7 @@
"react-redux"
:
"^8.0.1"
,
"react-router-dom"
:
"^6.3.0"
,
"react-scripts"
:
"5.0.1"
,
"redux"
:
"^4.
2.0
"
,
"redux"
:
"^4.
1.2
"
,
"web-vitals"
:
"^2.1.4"
},
"scripts"
:
{
...
...
weather_briefing/src/component/views/RegisterPage/RegisterPage.js
View file @
968b2d5
import
React
,
{
useCallback
,
useState
}
from
"react"
;
import
{
useDispatch
}
from
"react-redux"
;
import
{
register
}
from
"../../../modules/user"
;
import
"../style/RegisterPage.scss"
function
RegisterPage
(
props
)
{
const
dispatch
=
useDispatch
();
const
[
Name
,
setName
]
=
useState
(
""
);
const
[
Sex
,
setSex
]
=
useState
(
""
);
...
...
@@ -94,8 +97,18 @@ function RegisterPage(props) {
name
:
Name
,
id
:
Id
,
password
:
Password
,
sex
:
Sex
,
};
gender
:
Sex
,
}
dispatch
(
register
(
UserData
)
.
then
(
res
=>
{
if
(
res
.
payload
.
success
)
{
props
.
history
.
push
(
'/login'
);
}
else
{
alert
(
res
.
payload
.
error
);
}
})
);
}
},
[
checkIdError
,
checkNameError
,
checkPasswordError
,
checkRegisterError
,
checkSexError
,
Password
,
PasswordCheck
,
Sex
]);
...
...
weather_briefing/src/index.js
View file @
968b2d5
...
...
@@ -2,16 +2,24 @@ import React from 'react';
import
ReactDOM
from
'react-dom/client'
;
import
'./index.css'
;
import
App
from
'./App'
;
import
{
Provider
}
from
'react-redux'
;
import
{
createStore
}
from
'redux'
;
import
reportWebVitals
from
'./reportWebVitals'
;
import
{
BrowserRouter
}
from
'react-router-dom'
;
import
rootReducer
from
'./modules/Index'
;
import
{
composeWithDevTools
}
from
'redux-devtools-extension'
;
const
store
=
createStore
(
rootReducer
,
composeWithDevTools
());
const
root
=
ReactDOM
.
createRoot
(
document
.
getElementById
(
'root'
));
root
.
render
(
<
React
.
StrictMode
>
<
BrowserRouter
>
<
App
/>
<
/BrowserRouter
>
<
/React.StrictMode
>
<
Provider
store
=
{
store
}
>
<
React
.
StrictMode
>
<
BrowserRouter
>
<
App
/>
<
/BrowserRouter
>
<
/React.StrictMode
>
<
/Provider
>
);
// If you want to start measuring performance in your app, pass a function
...
...
weather_briefing/src/modules/Index.js
0 → 100644
View file @
968b2d5
import
{
combineReducers
}
from
"redux"
;
import
user
from
"./user"
;
const
rootReducer
=
combineReducers
({
user
,
})
export
default
rootReducer
;
\ No newline at end of file
weather_briefing/src/modules/user.js
0 → 100644
View file @
968b2d5
import
axios
from
'axios'
;
const
REGISTER
=
'user/REGISTER'
;
const
InitialState
=
{
name
:
'test'
,
id
:
'test123'
,
password
:
'test1111~'
,
gender
:
'1'
,
};
export
function
register
(
data
)
{
const
req
=
axios
.
post
(
'http://localhost:4000/register'
,
data
)
.
then
(
res
=>
res
.
data
);
return
{
type
:
REGISTER
,
payload
:
req
,
}
};
export
default
function
(
state
=
InitialState
,
action
)
{
switch
(
action
.
type
)
{
case
REGISTER
:
return
{...
state
,
register
:
action
.
payload
};
break
;
default
:
return
state
;
}
};
\ No newline at end of file
Please
register
or
login
to post a comment