Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mutations.js « index « modules « stores « releases « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 55a8a488be896aac18fd9be992001f10ba25ee6f (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as types from './mutation_types';

export default {
  /**
   * Sets isLoading to true while the request is being made.
   * @param {Object} state
   */
  [types.REQUEST_RELEASES](state) {
    state.isLoading = true;
  },

  /**
   * Sets isLoading to false.
   * Sets hasError to false.
   * Sets the received data
   * Sets the received pagination information
   * @param {Object} state
   * @param {Object} resp
   */
  [types.RECEIVE_RELEASES_SUCCESS](state, { data, pageInfo }) {
    state.hasError = false;
    state.isLoading = false;
    state.releases = data;
    state.pageInfo = pageInfo;
  },

  /**
   * Sets isLoading to false.
   * Sets hasError to true.
   * Resets the data
   * @param {Object} state
   * @param {Object} data
   */
  [types.RECEIVE_RELEASES_ERROR](state) {
    state.isLoading = false;
    state.releases = [];
    state.hasError = true;
    state.pageInfo = {};
  },

  [types.SET_SORTING](state, sorting) {
    state.sorting = { ...state.sorting, ...sorting };
  },
};