Javascript Vue.js Snotify-在异步模式下触发多个调用
下面是我用来使用axios调用远程调用的代码,它基于向用户显示的服务器错误或成功通知中的错误类型。这是给原始文件的一封信Javascript Vue.js Snotify-在异步模式下触发多个调用,javascript,vue.js,vuejs2,async-await,axios,Javascript,Vue.js,Vuejs2,Async Await,Axios,下面是我用来使用axios调用远程调用的代码,它基于向用户显示的服务器错误或成功通知中的错误类型。这是给原始文件的一封信 async getResponseFromServer() { if (this.errors.all().length == 0) { this.$snotify.clear(); this.$snotify.async( "Getting Data", "Loading...", () =>
async getResponseFromServer() {
if (this.errors.all().length == 0) {
this.$snotify.clear();
this.$snotify.async(
"Getting Data",
"Loading...",
() =>
new Promise((resolve, reject) => {
return this.getDataCommonResponse()
.then(function(response) {
if (response.status && response.type == undefined) {
resolve({
title: response.error,
body: "This is the balance",
config: {
closeOnClick: true,
position: SnotifyPosition.centerTop
}
});
} else {
reject({
title: "Error",
body: response.error,
config: {
closeOnClick: true,
position: SnotifyPosition.centerTop
}
});
}
})
.catch(function(error) {});
})
);
}
}
在GitHub中还有一个。它说Snotify将发出2个API调用,但会发出多个请求。有没有办法限制一个API调用
有办法解决这个问题吗