add list of available countries

This commit is contained in:
GotPPay
2018-09-03 14:25:14 +02:00
committed by Bilal Catic
parent 4ce7b86ea9
commit b3cff5d095
2 changed files with 37 additions and 27 deletions

View File

@@ -124,32 +124,17 @@ const recieveCountries = (json) => ({
export const fetchCountries = () => {
return dispatch => {
dispatch(requestCountries());
dispatch(recieveCountries([
{
"idCountry": 3,
"countryName": "Denmark"
},
{
"idCountry": 4,
"countryName": "Finland"
},
{
"idCountry": 2,
"countryName": "Sweden"
}
]));
// return client.fetch({
// url: `${API_SERVER}/profileSettings/api/getCoutnries`,
// method: 'get'
// })
// .then(response => {
// if(response.data){
// dispatch(recieveCountries(response.data));
// }
// })
// .catch(error => {
// client.onError(error, dispatch);
// });
return client.fetch({
url: `${API_SERVER}/wp-json/wiaas/user/get-countries`,
method: 'get'
})
.then(response => {
if(response.data){
dispatch(recieveCountries(response.data));
}
})
.catch(error => {
client.onError(error, dispatch);
});
}
};