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

mutations.js « stores « explorer « registry « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fda788051c0be02fd2a04ae93ea269826639ade9 (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
import * as types from './mutation_types';
import { parseIntPagination, normalizeHeaders } from '~/lib/utils/common_utils';

export default {
  [types.SET_INITIAL_STATE](state, config) {
    state.config = {
      ...config,
      expirationPolicy: config.expirationPolicy ? JSON.parse(config.expirationPolicy) : undefined,
      isGroupPage: config.isGroupPage !== undefined,
      isAdmin: config.isAdmin !== undefined,
    };
  },

  [types.SET_IMAGES_LIST_SUCCESS](state, images) {
    state.images = images;
  },

  [types.SET_TAGS_LIST_SUCCESS](state, tags) {
    state.tags = tags;
  },

  [types.SET_MAIN_LOADING](state, isLoading) {
    state.isLoading = isLoading;
  },

  [types.SET_SHOW_GARBAGE_COLLECTION_TIP](state, showGarbageCollectionTip) {
    state.showGarbageCollectionTip = showGarbageCollectionTip;
  },

  [types.SET_PAGINATION](state, headers) {
    const normalizedHeaders = normalizeHeaders(headers);
    state.pagination = parseIntPagination(normalizedHeaders);
  },

  [types.SET_TAGS_PAGINATION](state, headers) {
    const normalizedHeaders = normalizeHeaders(headers);
    state.tagsPagination = parseIntPagination(normalizedHeaders);
  },
};