All files / src/store/types splits.types.js

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56      42x                 42x           42x                 42x                                                        
import NS from './modules.types';
import createFq from './utils';
 
export const SPLITS_MUT = Object.freeze({
  setSplitResults: 'SET_SPLIT_RESULTS',
  setAvailableRecipes: 'SET_AVAILABLE_RECIPES',
  setAvailableSplitOptions: 'SET_AVAILABLE_SPLIT_OPTIONS',
  setLoading: 'SET_LOADING',
  setError: 'SET_ERROR',
  setLastFetchedAt: 'SET_LAST_FETCHED_AT',
});
 
export const SPLITS_ACT = Object.freeze({
  hydrate: 'HYDRATE',
  load: 'LOAD',
  fetchSplitResults: 'FETCH_SPLIT_RESULTS',
});
 
export const SPLITS_GET = Object.freeze({
  splitResults: 'splitResults',
  availableRecipes: 'availableRecipes',
  availableSplitOptions: 'availableSplitOptions',
  isLoading: 'isLoading',
  error: 'error',
  errorMessage: 'errorMessage',
});
 
export const SPLITS_FQ = Object.freeze({
  getters: Object.freeze({
    splitResults: createFq(NS.splits, SPLITS_GET.splitResults),
    availableRecipes: createFq(NS.splits, SPLITS_GET.availableRecipes),
    availableSplitOptions: createFq(
      NS.splits,
      SPLITS_GET.availableSplitOptions,
    ),
    isLoading: createFq(NS.splits, SPLITS_GET.isLoading),
    error: createFq(NS.splits, SPLITS_GET.error),
    errorMessage: createFq(NS.splits, SPLITS_GET.errorMessage),
  }),
  actions: Object.freeze({
    hydrate: createFq(NS.splits, SPLITS_ACT.hydrate),
    load: createFq(NS.splits, SPLITS_ACT.load),
    fetchSplitResults: createFq(NS.splits, SPLITS_ACT.fetchSplitResults),
  }),
  mutations: Object.freeze({
    setSplitResults: createFq(NS.splits, SPLITS_MUT.setSplitResults),
    setAvailableRecipes: createFq(NS.splits, SPLITS_MUT.setAvailableRecipes),
    setAvailableSplitOptions: createFq(
      NS.splits,
      SPLITS_MUT.setAvailableSplitOptions,
    ),
    setLoading: createFq(NS.splits, SPLITS_MUT.setLoading),
    setError: createFq(NS.splits, SPLITS_MUT.setError),
  }),
});