summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/store/getters.js
blob: 8d3efa0b2bfa39da982dd0981b395d5e16458b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 summaryStatus = state => {
  if (state.isLoading) {
    return LOADING;
  }

  if (state.hasError) {
    return ERROR;
  }

  return SUCCESS;
};