김건희

[Update] Weather Redux File

...@@ -3,9 +3,9 @@ import axios from 'axios'; ...@@ -3,9 +3,9 @@ import axios from 'axios';
3 const USER_REGISTER = 'user/REGISTER'; 3 const USER_REGISTER = 'user/REGISTER';
4 const USER_LOGIN = 'user/LOGIN'; 4 const USER_LOGIN = 'user/LOGIN';
5 5
6 -export function register(dataToSubmit) { 6 +export async function register (dataToSubmit) {
7 7
8 - const req = axios.post('http://localhost:4000/api/register', dataToSubmit) 8 + const req = await axios.post('http://localhost:4000/api/register', dataToSubmit)
9 .then(res => res.data); 9 .then(res => res.data);
10 10
11 return { 11 return {
......
1 import axios from "axios"; 1 import axios from "axios";
2 2
3 const WEATHER_ADDRESS = 'weather/ADDRESS'; 3 const WEATHER_ADDRESS = 'weather/ADDRESS';
4 +const WEATHER_COORDINATE = 'weather/COORDINATE';
4 const WEATHER_TODAY_INFORMATION = 'weather/TODAY_INFORMATION'; 5 const WEATHER_TODAY_INFORMATION = 'weather/TODAY_INFORMATION';
5 6
7 +export function address() {
8 + const req = axios.post('http://localhost:4000/api/address')
9 + .then(res => res.data);
10 +
11 + return {
12 + type: WEATHER_ADDRESS,
13 + payload: req,
14 + }
15 +}
16 +
6 export function coordinate(dataToSubmit) { 17 export function coordinate(dataToSubmit) {
7 18
8 - const req = axios.post('http://localhost:4000/api/address', dataToSubmit) 19 + const req = axios.post('http://localhost:4000/api/cordinate', dataToSubmit)
9 .then(res => res.data); 20 .then(res => res.data);
10 21
11 return { 22 return {
12 - type: WEATHER_ADDRESS, 23 + type: WEATHER_COORDINATE,
13 payload: req, 24 payload: req,
14 } 25 }
15 }; 26 };
16 27
17 export function information(dataToSubmit) { 28 export function information(dataToSubmit) {
18 29
19 - const req = axios.post('http://localhost:4000/api/mainpage', dataToSubmit) 30 + const req = axios.post('http://localhost:4000/api/weather', dataToSubmit)
20 .then(res => res.data); 31 .then(res => res.data);
21 32
22 return { 33 return {
...@@ -28,6 +39,9 @@ export function information(dataToSubmit) { ...@@ -28,6 +39,9 @@ export function information(dataToSubmit) {
28 export default function (state = {}, action) { 39 export default function (state = {}, action) {
29 switch (action.type) { 40 switch (action.type) {
30 case WEATHER_ADDRESS: 41 case WEATHER_ADDRESS:
42 + return { ...state, address: action.payload };
43 + break;
44 + case WEATHER_COORDINATE:
31 return { ...state, dot: action.payload }; 45 return { ...state, dot: action.payload };
32 break; 46 break;
33 case WEATHER_TODAY_INFORMATION: 47 case WEATHER_TODAY_INFORMATION:
......