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: 19b4d4ec33062acc6b66c3df3f235290547ad5a6 (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
29
30
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 = [...state.autocompleteOptions].concat(
      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;
  },
};