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

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

23 lines
592 B
JavaScript
Raw Normal View History

2021-11-18 22:05:49 +05:30
import axios from '~/lib/utils/axios_utils';
2021-11-11 11:23:49 +05:30
import * as types from './mutation_types';
2021-11-18 22:05:49 +05:30
export const fetchAutocompleteOptions = ({ commit, getters }) => {
commit(types.REQUEST_AUTOCOMPLETE);
return axios
.get(getters.autocompleteQuery)
2022-06-21 17:19:12 +05:30
.then(({ data }) => {
commit(types.RECEIVE_AUTOCOMPLETE_SUCCESS, data);
})
2021-11-18 22:05:49 +05:30
.catch(() => {
commit(types.RECEIVE_AUTOCOMPLETE_ERROR);
});
};
2022-01-26 12:08:38 +05:30
export const clearAutocomplete = ({ commit }) => {
commit(types.CLEAR_AUTOCOMPLETE);
};
2021-11-11 11:23:49 +05:30
export const setSearch = ({ commit }, value) => {
commit(types.SET_SEARCH, value);
};