The-Commit-Company / frappe-js-sdk

TypeScript/JavaScript library for Frappe REST API
MIT License
120 stars 43 forks source link

Switching from Axios to fetch? #28

Closed nikkothari22 closed 1 year ago

nikkothari22 commented 1 year ago

Not sure if this is the right call, but been hearing a lot of talk about how fetch actually solves most problems without adding a dependency.

One of the main reasons for choosing Axios was the progress of file uploads (its inbuilt in its API), and also the fact that we can add data transformation functions on top of it (though we haven't used that much).

@NagariaHussain thoughts?

Context: https://twitter.com/cramforce/status/1661725101916831745?s=46&t=DbCDQNfXArwKw6dv_wcLdA

nikkothari22 commented 1 year ago

More context: https://blog.logrocket.com/axios-vs-fetch-best-http-requests/

Axios does offer more features - it's just that this library does not use/allow devs to use as of now. But it's something that we might want to do. I guess we can keep it as is for now.

Very difficult to keep off of JS hype-cycles 😅😂

NagariaHussain commented 1 year ago

I guess we can keep it as is for now.

Yup, agreed. Let's keep axios, since it also does some stuff automagically without setup (like single instance with config etc.) which would require additional code in case of fetch. Also, it works flawlessly in non-browser environments as well, in contrast fetch has to be poly-filled by external lib and will increase maintenance overhead.

Very difficult to keep off of JS hype-cycles 😅😂

"Don't trouble trouble until trouble troubles you. 😅"