3 ms·
function ajax({url,success,error}) { fetch(url).then(success, error) } Boom, same syntax if that's what you prefer. J/K, the error status handling is not
by erhaetherth 3y ago
function ajax({url,success,error}) {
fetch(url).then(success, error)
}
Boom, same syntax if that's what you prefer.
J/K, the error status handling is not the same and the auto-deserialization isn't present. Not hard to add but it's harder to argue not to use a lib instead of copy-pasting 114 lines of niceties into each project.
- duskwuff 3y ago> the auto-deserialization isn't present You mean like response.json()?