Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch with Axios doesn't work #51

Open
tarim opened this issue Sep 26, 2018 · 2 comments
Open

Dispatch with Axios doesn't work #51

tarim opened this issue Sep 26, 2018 · 2 comments

Comments

@tarim
Copy link

tarim commented Sep 26, 2018

Hi There,

I am using your app, and I have an issue for HTTP request with the axios. I don't know why it doesn't work. I used it before with my other applications.
Can you help me, please?

Here is some code
export function getUsers() { return function (dispatch) { dispatch(Action.startLoadingSuccess()); GET(/api/v1/accounts/user`).then(response => {
if(response && response.data) dispatch(Action.getUserSuccess(response));
}).catch(err => { console.log('error is: ', err);
if (err.response && err.response.data) toastr.error('', err.response.data.message, toastrOption);
else {if(err.message) toastr.error('', err.message, toastrOption);}
});
};

}`

@albertbarbosa
Copy link

albertbarbosa commented Jan 23, 2019

Hi.

I have tried to use axios on my project, too.
export const search = (value) => {
return dispatch => {
axios.get('https://data.buyingazhomes.com/ownership/fuzzy/?query=13 E Coronado 85006')
.then(response => {
console.log(response.data)
})

dispatch({
  type: SEARCH
})

}
}

But I got CORS error.
Is there any solution to use axios in this project?

@vipinlahoti
Copy link

@albertbarbosa you can refer this #71, added an Axios support for a get request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants