简化写法

pull/96/head
lyswhut 2019-10-28 22:48:30 +08:00
parent 63a5f94a67
commit 91e4e9c2d5
2 changed files with 2 additions and 2 deletions

View File

@ -95,7 +95,7 @@ export default {
cancelHttp(this._cancelRequestObj2)
this._cancelPromiseCancelFn2(new Error('取消http请求'))
}
if (this.isGetingToken) return Promise.reject(new Error('正在获取token'))
if (this.isGetingToken) throw new Error('正在获取token')
let token = this.token
if (!token) {
this.isGetingToken = true

View File

@ -36,7 +36,7 @@ export default {
},
async search(str) {
let token = this.token
if (this.isGetingToken) return Promise.reject(new Error('正在获取token'))
if (this.isGetingToken) throw new Error('正在获取token')
if (!this.token) {
this.isGetingToken = true
token = await getToken()