Pressing return on searchbar to search for artists

This commit is contained in:
Ciarán Ainsworth 2019-07-02 09:27:07 +02:00 committed by Eliot Berriot
parent 3fde0d9d30
commit ee255783a2
1 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,18 @@ export default {
let albumLabel = this.$pgettext('*/*/*', 'Album')
let trackLabel = this.$pgettext('*/*/*/Noun', 'Track')
let self = this
var searchQuery;
jQuery(this.$el).keypress(function(e) {
if(e.which == 13) {
// Cancel any API search request to backend...
jQuery(this.$el).search('cancel query');
// Go direct to the artist page...
router.push("/library/artists?query=" + searchQuery + "&page=1&paginateBy=25&ordering=name");
}
});
jQuery(this.$el).search({
type: 'category',
minCharacters: 3,
@ -41,6 +53,7 @@ export default {
},
onSearchQuery (query) {
self.$emit('search')
searchQuery = query;
},
apiSettings: {
beforeXHR: function (xhrObject) {