debian-mirror-gitlab/app/assets/javascripts/header_search/store/mutations.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
793 B
JavaScript
Raw Normal View History

2021-11-11 11:23:49 +05:30
import * as types from './mutation_types';
export default {
2021-11-18 22:05:49 +05:30
[types.REQUEST_AUTOCOMPLETE](state) {
state.loading = true;
state.autocompleteOptions = [];
2022-05-07 20:08:51 +05:30
state.autocompleteError = false;
2021-11-18 22:05:49 +05:30
},
[types.RECEIVE_AUTOCOMPLETE_SUCCESS](state, data) {
state.loading = false;
2022-01-26 12:08:38 +05:30
state.autocompleteOptions = data.map((d, i) => {
return { html_id: `autocomplete-${d.category}-${i}`, ...d };
});
2022-05-07 20:08:51 +05:30
state.autocompleteError = false;
2021-11-18 22:05:49 +05:30
},
[types.RECEIVE_AUTOCOMPLETE_ERROR](state) {
state.loading = false;
state.autocompleteOptions = [];
2022-05-07 20:08:51 +05:30
state.autocompleteError = true;
2021-11-18 22:05:49 +05:30
},
2022-01-26 12:08:38 +05:30
[types.CLEAR_AUTOCOMPLETE](state) {
state.autocompleteOptions = [];
2022-05-07 20:08:51 +05:30
state.autocompleteError = false;
2022-01-26 12:08:38 +05:30
},
2021-11-11 11:23:49 +05:30
[types.SET_SEARCH](state, value) {
state.search = value;
},
};