Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mutations.js « store « header_search « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 92948bec5151cbaeb028603e8d54022db4068971 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as types from './mutation_types';

export default {
  [types.REQUEST_AUTOCOMPLETE](state) {
    state.loading = true;
    state.autocompleteOptions = [];
    state.autocompleteError = false;
  },
  [types.RECEIVE_AUTOCOMPLETE_SUCCESS](state, data) {
    state.loading = false;
    state.autocompleteOptions = data.map((d, i) => {
      return { html_id: `autocomplete-${d.category}-${i}`, ...d };
    });
    state.autocompleteError = false;
  },
  [types.RECEIVE_AUTOCOMPLETE_ERROR](state) {
    state.loading = false;
    state.autocompleteOptions = [];
    state.autocompleteError = true;
  },
  [types.CLEAR_AUTOCOMPLETE](state) {
    state.autocompleteOptions = [];
    state.autocompleteError = false;
  },
  [types.SET_SEARCH](state, value) {
    state.search = value;
  },
};