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-31 03:18:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
07ca8cc3f2dad48bf07c23ea6a27a38444e6b750
07ca8cc3
1 parent
31fde4e5
[Add] Weather Redux Setting
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
weather_briefing/src/modules/Index.js
weather_briefing/src/modules/weather.js
weather_briefing/src/modules/Index.js
View file @
07ca8cc
import
{
combineReducers
}
from
"redux"
;
import
user
from
"./user.js"
;
import
weather
from
"./weather"
;
const
rootReducer
=
combineReducers
({
user
,
weather
,
})
export
default
rootReducer
;
\ No newline at end of file
...
...
weather_briefing/src/modules/weather.js
0 → 100644
View file @
07ca8cc
import
axios
from
"axios"
;
const
WEATHER_ADDRESS
=
'weather/ADDRESS'
;
const
WEATHER_TODAY_INFORMATION
=
'weather/TODAY_INFORMATION'
;
export
function
coordinate
(
dataToSubmit
)
{
const
req
=
axios
.
post
(
'http://localhost:4000/api/address'
,
dataToSubmit
)
.
then
(
res
=>
res
.
data
);
return
{
type
:
WEATHER_ADDRESS
,
payload
:
req
,
}
};
export
function
information
(
dataToSubmit
)
{
const
req
=
axios
.
post
(
'http://localhost:4000/api/mainpage'
,
dataToSubmit
)
.
then
(
res
=>
res
.
data
);
return
{
type
:
WEATHER_TODAY_INFORMATION
,
payload
:
req
,
}
};
export
default
function
(
state
=
{},
action
)
{
switch
(
action
.
type
)
{
case
WEATHER_ADDRESS
:
return
{
...
state
,
dot
:
action
.
payload
};
break
;
case
WEATHER_TODAY_INFORMATION
:
return
{
...
state
,
todayInformation
:
action
.
payload
};
break
;
default
:
return
state
;
}
}
\ No newline at end of file
Please
register
or
login
to post a comment