summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/codequality_report/store/mutations.js
blob: 8edeb6cc97665d3067ba748e1e3a926833b94eca (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
import * as types from './mutation_types';

export default {
  [types.SET_PATHS](state, paths) {
    state.basePath = paths.basePath;
    state.reportsPath = paths.reportsPath;
    state.helpPath = paths.helpPath;
  },
  [types.REQUEST_REPORTS](state) {
    state.isLoading = true;
  },
  [types.RECEIVE_REPORTS_SUCCESS](state, data) {
    state.hasError = false;
    state.statusReason = '';
    state.isLoading = false;
    state.newIssues = data.newIssues;
    state.resolvedIssues = data.resolvedIssues;
  },
  [types.RECEIVE_REPORTS_ERROR](state, error) {
    state.isLoading = false;
    state.hasError = true;
    state.statusReason = error?.response?.data?.status_reason;
  },
};