fix code error
This commit is contained in:
parent
7c05d729b4
commit
93ddf08615
2 changed files with 12 additions and 2 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 0.4.2
|
||||||
|
## Bug fixes
|
||||||
|
- Correct catch ajax error
|
||||||
|
|
||||||
## 0.4.1
|
## 0.4.1
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
- catch ajax error
|
- catch ajax error
|
||||||
|
|
|
||||||
10
src/ajax.js
10
src/ajax.js
|
|
@ -5,7 +5,13 @@ export default function (url, options = {}) {
|
||||||
xhr.send()
|
xhr.send()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
then: cb => xhr.addEventListener('load', cb),
|
then: function (cb) {
|
||||||
catch: cb => xhr.addEventListener('error', cb)
|
xhr.addEventListener('load', cb)
|
||||||
|
return this
|
||||||
|
},
|
||||||
|
catch: function (cb) {
|
||||||
|
xhr.addEventListener('error', cb)
|
||||||
|
return this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue