summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/mutations/project.js
blob: 9230f3839c15b7945e55a9b3ca6b372c527e7c23 (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
import * as types from '../mutation_types';

export default {
  [types.SET_CURRENT_PROJECT](state, currentProjectId) {
    Object.assign(state, {
      currentProjectId,
    });
  },
  [types.SET_PROJECT](state, { projectPath, project }) {
    // Add client side properties
    Object.assign(project, {
      tree: [],
      branches: {},
      mergeRequests: {},
      active: true,
    });

    Object.assign(state, {
      projects: Object.assign({}, state.projects, {
        [projectPath]: project,
      }),
    });
  },
  [types.TOGGLE_EMPTY_STATE](state, { projectPath, value }) {
    Object.assign(state.projects[projectPath], {
      empty_repo: value,
    });
  },
};