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

Replace Axios => Fetch #773

Closed
divyanshu-rawat opened this issue Apr 10, 2020 · 4 comments
Closed

Replace Axios => Fetch #773

divyanshu-rawat opened this issue Apr 10, 2020 · 4 comments

Comments

@divyanshu-rawat
Copy link
Member

Is your feature request related to a problem? Please describe.
Should we replace our axios calls with fetch api?

Describe the solution you'd like
As fetch is native to browser, so do we need an additional NPM package like axios to communicate to server from client.

Describe alternatives you've considered
N.A

Additional context
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

@divyanshu-rawat
Copy link
Member Author

what do you think @Marvin9 , @abhu-A-J , @Paarmita ? :)

@Marvin9
Copy link
Member

Marvin9 commented Apr 11, 2020

I read this article, I think we should stick with axios.

@abhushanaj
Copy link
Member

abhushanaj commented Apr 11, 2020

@divyanshu-rawat I think we can replicate all the features of Axios with fetch. The only reason why I might prefer Axios is for its backward compatibility I guess!
Also sometimes fetch can handle bad request a little weird if you place catch before then. Something like this:

const url = 'https://jsonplacehoer.typicode.com/todos/1';
fetch(url)
.catch(error => console.log('BAD'))
.then(response => console.log('GOOD'));

It's still gonna run then block. Axios handles this 'correctlyas well! But it is a minor thing! I think you should keepAxios`!

Edit: The article that @Marvin9 mentioned above also seems to mention the same issue!

@github-actions
Copy link

Stale issue message

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

No branches or pull requests

3 participants