All files / ee/app/assets/javascripts/geo_settings/store mutations.js

100% Statements 17/17
100% Branches 0/0
100% Functions 9/9
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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          3x     2x 2x 2x     2x 2x 2x     1x     1x 1x 1x     2x 2x 2x     5x     10x     16x      
import { DEFAULT_TIMEOUT, DEFAULT_ALLOWED_IP } from '../constants';
import * as types from './mutation_types';
 
export default {
  [types.REQUEST_GEO_SETTINGS](state) {
    state.isLoading = true;
  },
  [types.RECEIVE_GEO_SETTINGS_SUCCESS](state, { timeout, allowedIp }) {
    state.isLoading = false;
    state.timeout = timeout;
    state.allowedIp = allowedIp;
  },
  [types.RECEIVE_GEO_SETTINGS_ERROR](state) {
    state.isLoading = false;
    state.timeout = DEFAULT_TIMEOUT;
    state.allowedIp = DEFAULT_ALLOWED_IP;
  },
  [types.REQUEST_UPDATE_GEO_SETTINGS](state) {
    state.isLoading = true;
  },
  [types.RECEIVE_UPDATE_GEO_SETTINGS_SUCCESS](state, { timeout, allowedIp }) {
    state.isLoading = false;
    state.timeout = timeout;
    state.allowedIp = allowedIp;
  },
  [types.RECEIVE_UPDATE_GEO_SETTINGS_ERROR](state) {
    state.isLoading = false;
    state.timeout = DEFAULT_TIMEOUT;
    state.allowedIp = DEFAULT_ALLOWED_IP;
  },
  [types.SET_TIMEOUT](state, timeout) {
    state.timeout = timeout;
  },
  [types.SET_ALLOWED_IP](state, allowedIp) {
    state.allowedIp = allowedIp;
  },
  [types.SET_FORM_ERROR](state, { key, error }) {
    state.formErrors[key] = error;
  },
};