mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
fix long lasting request getPrestudents to block browser when timedout once
This commit is contained in:
@@ -35,8 +35,16 @@ export default {
|
||||
});
|
||||
},
|
||||
loadData(evt) {
|
||||
if (this.abortController)
|
||||
this.abortController.abort();
|
||||
if( evt.query.length < 2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.abortController instanceof AbortController
|
||||
&& this.abortController.signal.aborted === false)
|
||||
{
|
||||
this.abortController.abort();
|
||||
}
|
||||
this.abortController = new AbortController();
|
||||
|
||||
this.$fhcApi.factory
|
||||
@@ -44,7 +52,14 @@ export default {
|
||||
.then(result => {
|
||||
this.data = result.data;
|
||||
})
|
||||
.catch(this.$fhcApi.handleSystemError);
|
||||
.catch(error => {
|
||||
if (this.abortController instanceof AbortController
|
||||
&& this.abortController.signal.aborted === false)
|
||||
{
|
||||
this.abortController.abort();
|
||||
}
|
||||
this.$fhcApi.handleSystemError(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
template: `
|
||||
|
||||
Reference in New Issue
Block a user