Skip to content

Commit

Permalink
fix await usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Wonday committed May 9, 2018
1 parent 23b7dea commit a7b04bc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default class Pdf extends Component {
.then(() => {
this.setState({path: cacheFile, isDownloaded: true});
})
.catch(error => {
.catch(async (error) => {
await RNFetchBlob.fs.unlink(cacheFile);
this._onError(error);
})
Expand All @@ -197,7 +197,7 @@ export default class Pdf extends Component {
//__DEV__ && console.log("write base64 to file:" + cacheFile);
this.setState({path: cacheFile, isDownloaded: true});
})
.catch(error => {
.catch(async (error) => {
await RNFetchBlob.fs.unlink(cacheFile);
this._onError(error)
});
Expand Down Expand Up @@ -242,7 +242,7 @@ export default class Pdf extends Component {
});

this.lastRNBFTask
.then(res => {
.then(async (res) => {
let {status} = res.respInfo;
this.lastRNBFTask = null;

Expand All @@ -258,13 +258,13 @@ export default class Pdf extends Component {
.then(() => {
this.setState({path: cacheFile, isDownloaded: true, progress: 1});
})
.catch(error => {
.catch(async (error) => {
await RNFetchBlob.fs.unlink(tempCacheFile);
await RNFetchBlob.fs.unlink(cacheFile);
this._onError(error)
})
})
.catch(error => {
.catch(async (error) => {
await RNFetchBlob.fs.unlink(tempCacheFile);
await RNFetchBlob.fs.unlink(cacheFile);
this._onError(error)
Expand All @@ -278,7 +278,7 @@ export default class Pdf extends Component {
break;
}
})
.catch(error => {
.catch(async (error) => {
await RNFetchBlob.fs.unlink(tempCacheFile);
await RNFetchBlob.fs.unlink(cacheFile);
this._onError(error);
Expand Down

0 comments on commit a7b04bc

Please sign in to comment.