mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-02 12:49:27 +00:00
add abort controller to autocomplete fields
This commit is contained in:
@@ -193,8 +193,9 @@ export default{
|
||||
filteredFirmen: [],
|
||||
abortController: {
|
||||
suggestions: null,
|
||||
places: null
|
||||
}
|
||||
places: null,
|
||||
firmen: null
|
||||
},
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
@@ -306,7 +307,13 @@ export default{
|
||||
});
|
||||
},
|
||||
search(event) {
|
||||
return this.$fhcApi.factory.stv.kontakt.getFirmen(event.query)
|
||||
if (this.abortController.firmen) {
|
||||
this.abortController.firmen.abort();
|
||||
}
|
||||
|
||||
this.abortController.firmen = new AbortController();
|
||||
|
||||
return this.$refs.addressData.factory.stv.kontakt.getFirmen(event.query)
|
||||
.then(result => {
|
||||
this.filteredFirmen = result.data.retval;
|
||||
});
|
||||
|
||||
@@ -140,6 +140,10 @@ export default{
|
||||
firmen: [],
|
||||
filteredFirmen: [],
|
||||
filteredOrte: null,
|
||||
abortController: {
|
||||
firmen: null,
|
||||
standorte: null
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -234,13 +238,24 @@ export default{
|
||||
this.$refs.table.reloadTable();
|
||||
},
|
||||
searchFirma(event) {
|
||||
return this.$fhcApi
|
||||
.get('api/frontend/v1/stv/kontakt/getFirmen/' + event.query)
|
||||
if (this.abortController.firmen) {
|
||||
this.abortController.firmen.abort();
|
||||
}
|
||||
|
||||
this.abortController.firmen = new AbortController();
|
||||
|
||||
return this.$fhcApi.factory.stv.kontakt.getFirmen(event.query)
|
||||
.then(result => {
|
||||
this.filteredFirmen = result.data.retval;
|
||||
});
|
||||
},
|
||||
loadStandorte(firmen_id) {
|
||||
if (this.abortController.standorte) {
|
||||
this.abortController.standorte.abort();
|
||||
}
|
||||
|
||||
this.abortController.standorte = new AbortController();
|
||||
|
||||
return this.$fhcApi.factory.stv.kontakt.getStandorteByFirma(firmen_id)
|
||||
.then(result => {
|
||||
this.filteredOrte = result.data;
|
||||
|
||||
Reference in New Issue
Block a user