No need to query the API about nothing

This commit is contained in:
Toby Zerner 2015-06-19 15:49:20 +09:30
parent 6455d03eb6
commit 80474ec544

View File

@ -152,15 +152,17 @@ export default function() {
dropdown.active(true); dropdown.active(true);
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchTimeout = setTimeout(function() { if (typed) {
var typedLower = typed.toLowerCase(); searchTimeout = setTimeout(function() {
if (searched.indexOf(typedLower) === -1) { var typedLower = typed.toLowerCase();
app.store.find('users', {q: typed, page: {limit: 5}}).then(users => { if (searched.indexOf(typedLower) === -1) {
if (dropdown.active()) buildSuggestions(); app.store.find('users', {q: typed, page: {limit: 5}}).then(users => {
}); if (dropdown.active()) buildSuggestions();
searched.push(typedLower); });
} searched.push(typedLower);
}, 250); }
}, 250);
}
} }
}); });
}); });