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