summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/store/getters.js
blob: 5fbafa201b5aa6cb14fc2be376925f62984ec7cc (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 { LOADING, ERROR, SUCCESS } from '../constants';

export const reports = state => state.reports;
export const summaryCounts = state => state.summary;
export const isLoading = state => state.isLoading;
export const hasError = state => state.hasError;
export const modalTitle = state => state.modal.title || '';
export const modalData = state => state.modal.data || {};
export const isCreatingNewIssue = state => state.modal.isLoading;

export const summaryStatus = state => {
  if (state.isLoading) {
    return LOADING;
  }

  if (state.hasError) {
    return ERROR;
  }

  return SUCCESS;
};

// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};