Showing
4 changed files
with
70 additions
and
15 deletions
... | @@ -107,19 +107,19 @@ function RegisterPage(props) { | ... | @@ -107,19 +107,19 @@ function RegisterPage(props) { |
107 | // 액션생성함수 | 107 | // 액션생성함수 |
108 | dispatch(register(UserData)); | 108 | dispatch(register(UserData)); |
109 | registerResult.then((result) => { | 109 | registerResult.then((result) => { |
110 | - console.log(result); | 110 | + console.log(result); |
111 | - | 111 | + |
112 | - if (result.registerSuccess === '1') { | 112 | + if (result.registerSuccess === '1') { |
113 | - alert('회원 가입 완료!'); | 113 | + alert('회원 가입 완료!'); |
114 | - navigate('/login'); | 114 | + navigate('/login'); |
115 | - } | 115 | + } |
116 | - else if (result.registerSuccess === '0') { | 116 | + else if (result.registerSuccess === '0') { |
117 | - alert('중복된 아이디 존재ㅠㅠ'); | 117 | + alert('중복된 아이디 존재ㅠㅠ'); |
118 | - } | 118 | + } |
119 | - else { | 119 | + else { |
120 | - alert('회원 가입 실패ㅜㅜ'); | 120 | + alert('회원 가입 실패ㅜㅜ'); |
121 | - } | 121 | + } |
122 | - }) | 122 | + }) |
123 | 123 | ||
124 | }; | 124 | }; |
125 | 125 | ... | ... |
1 | import { combineReducers } from "redux"; | 1 | import { combineReducers } from "redux"; |
2 | import user from "./user.js"; | 2 | import user from "./user.js"; |
3 | +import weather from "./weather"; | ||
3 | 4 | ||
4 | const rootReducer = combineReducers({ | 5 | const rootReducer = combineReducers({ |
5 | user, | 6 | user, |
7 | + weather, | ||
6 | }) | 8 | }) |
7 | 9 | ||
8 | export default rootReducer; | 10 | export default rootReducer; |
... | \ No newline at end of file | ... | \ No newline at end of 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 { | ... | ... |
weather_briefing/src/modules/weather.js
0 → 100644
1 | +import axios from "axios"; | ||
2 | + | ||
3 | +const WEATHER_ADDRESS = 'weather/ADDRESS'; | ||
4 | +const WEATHER_COORDINATE = 'weather/COORDINATE'; | ||
5 | +const WEATHER_TODAY_INFORMATION = 'weather/TODAY_INFORMATION'; | ||
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 | + | ||
17 | +export function coordinate(dataToSubmit) { | ||
18 | + | ||
19 | + const req = axios.post('http://localhost:4000/api/cordinate', dataToSubmit) | ||
20 | + .then(res => res.data); | ||
21 | + | ||
22 | + return { | ||
23 | + type: WEATHER_COORDINATE, | ||
24 | + payload: req, | ||
25 | + } | ||
26 | +}; | ||
27 | + | ||
28 | +export function information(dataToSubmit) { | ||
29 | + | ||
30 | + const req = axios.post('http://localhost:4000/api/weather', dataToSubmit) | ||
31 | + .then(res => res.data); | ||
32 | + | ||
33 | + return { | ||
34 | + type: WEATHER_TODAY_INFORMATION, | ||
35 | + payload: req, | ||
36 | + } | ||
37 | +}; | ||
38 | + | ||
39 | +export default function (state = {}, action) { | ||
40 | + switch (action.type) { | ||
41 | + case WEATHER_ADDRESS: | ||
42 | + return { ...state, address: action.payload }; | ||
43 | + break; | ||
44 | + case WEATHER_COORDINATE: | ||
45 | + return { ...state, dot: action.payload }; | ||
46 | + break; | ||
47 | + case WEATHER_TODAY_INFORMATION: | ||
48 | + return { ...state, todayInformation: action.payload }; | ||
49 | + break; | ||
50 | + default: | ||
51 | + return state; | ||
52 | + } | ||
53 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment