fix long lasting request getPrestudents to block browser when timedout once

This commit is contained in:
Harald Bamberger
2024-05-06 16:04:45 +02:00
parent 40c0393bc0
commit 6a8a96b748
2 changed files with 22 additions and 4 deletions
+4 -1
View File
@@ -117,7 +117,10 @@ export default {
return this.$fhcApi.post(
'/api/frontend/v1/studstatus/leitung/getPrestudents',
{ query },
{ signal }
{
signal: signal,
timeout: 30000
}
);
},
approve(antrag) {
@@ -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: `