So on my website I have a input box
<SearchBox v-model="searchTerm"/>
Which I watch and call an url via Axios
watch: {
searchTerm: function() {
axios
.get("https://robotic.buzz/skynet/search/" + searchTerm)
.then(response => {
// JSON responses are automatically parsed.
this.results = response.data;
})
.catch(e => {
this.errors.push(e);
});
}
}
Is there a way to delay the call and cancel previous ones? So if someone types something in, when they pause for 1 second, it then calls the server and doesn't call it for every letter they enter.
A simple 1-second delay would still queue up the calls.