debian-mirror-gitlab/app/assets/javascripts/search/store/mutations.js
2023-01-13 15:02:22 +05:30

39 lines
1.1 KiB
JavaScript

import * as types from './mutation_types';
export default {
[types.REQUEST_GROUPS](state) {
state.fetchingGroups = true;
},
[types.RECEIVE_GROUPS_SUCCESS](state, data) {
state.fetchingGroups = false;
state.groups = data;
},
[types.RECEIVE_GROUPS_ERROR](state) {
state.fetchingGroups = false;
state.groups = [];
},
[types.REQUEST_PROJECTS](state) {
state.fetchingProjects = true;
},
[types.RECEIVE_PROJECTS_SUCCESS](state, data) {
state.fetchingProjects = false;
state.projects = data;
},
[types.RECEIVE_PROJECTS_ERROR](state) {
state.fetchingProjects = false;
state.projects = [];
},
[types.SET_QUERY](state, { key, value }) {
state.query[key] = value;
},
[types.SET_SIDEBAR_DIRTY](state, value) {
state.sidebarDirty = value;
},
[types.LOAD_FREQUENT_ITEMS](state, { key, data }) {
state.frequentItems[key] = data;
},
[types.RECEIVE_NAVIGATION_COUNT](state, { key, count }) {
const item = { ...state.navigation[key], count };
state.navigation = { ...state.navigation, [key]: item };
},
};