| ▲ | Replace axios with a simple custom fetch wrapper(kentcdodds.com) | |||||||
| 16 points by mariuz 2 days ago | 4 comments | ||||||||
| ▲ | hackerman70000 19 hours ago | parent | next [-] | |||||||
Every team I've seen write a fetch wrapper eventually reimplements half of axios, just worse. The article works for a bookshelf demo app. In production you'll want retries, timeouts, request deduplication, cancellation - and suddenly your "simple wrapper" is a library with no tests and no docs | ||||||||
| ▲ | pheew a day ago | parent | prev | next [-] | |||||||
I’m all for replacing as much 3rd party libs with stdlib but it’s hard to look past the storing of the jwt in localStorage. Please don’t do that people. It’s very easily extracted through xss attacks. | ||||||||
| ||||||||
| ▲ | joeframbach 2 days ago | parent | prev [-] | |||||||
In the case of authentication redirect, any inflight request is going to fail and you're about to navigate in a few milliseconds, so I don't resolve those promises. Return new Promise(() => {}). | ||||||||