summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/modules/terminal/getters.js
blob: fb9a1a2fa3951c785a943737a296588f796ac943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export const allCheck = (state) => {
  const checks = Object.values(state.checks);

  if (checks.some((check) => check.isLoading)) {
    return { isLoading: true };
  }

  const invalidCheck = checks.find((check) => !check.isValid);
  const isValid = !invalidCheck;
  const message = !invalidCheck ? '' : invalidCheck.message;

  return {
    isLoading: false,
    isValid,
    message,
  };
};