Showing
3 changed files
with
33 additions
and
19 deletions
... | @@ -106,19 +106,19 @@ function RegisterPage(props) { | ... | @@ -106,19 +106,19 @@ function RegisterPage(props) { |
106 | 106 | ||
107 | dispatch(register(UserData)); | 107 | dispatch(register(UserData)); |
108 | registerResult.then((result) => { | 108 | registerResult.then((result) => { |
109 | - console.log(result); | 109 | + console.log(result); |
110 | - | 110 | + |
111 | - if (result.registerSuccess === '1') { | 111 | + if (result.registerSuccess === '1') { |
112 | - alert('회원 가입 완료!'); | 112 | + alert('회원 가입 완료!'); |
113 | - navigate('/login'); | 113 | + navigate('/login'); |
114 | - } | 114 | + } |
115 | - else if (result.registerSuccess === '0') { | 115 | + else if (result.registerSuccess === '0') { |
116 | - alert('중복된 아이디 존재ㅠㅠ'); | 116 | + alert('중복된 아이디 존재ㅠㅠ'); |
117 | - } | 117 | + } |
118 | - else { | 118 | + else { |
119 | - alert('회원 가입 실패ㅜㅜ'); | 119 | + alert('회원 가입 실패ㅜㅜ'); |
120 | - } | 120 | + } |
121 | - }) | 121 | + }) |
122 | 122 | ||
123 | }; | 123 | }; |
124 | 124 | ... | ... |
... | @@ -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 { |
23 | type: WEATHER_TODAY_INFORMATION, | 34 | type: WEATHER_TODAY_INFORMATION, |
24 | payload: req, | 35 | payload: req, |
25 | - } | 36 | + } |
26 | }; | 37 | }; |
27 | 38 | ||
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: | ... | ... |
-
Please register or login to post a comment