import isEmpty from 'lodash/isEmpty';
import CapNotification from '@capillarytech/cap-ui-library/CapNotification';
import messages from './Create/messages';
export function showError() {
  const {intl} = this.props;
  const {errorData} = this.state;
  const errorMessage = {key: 'validation-error', message: intl.formatMessage(messages.validationError)};
  if (!isEmpty(this.state.formData) && !this.state.isFormValid) {
    const err0 = errorData[0] || {};
    const isSmsInvalid = Object.values(err0).includes(true);
    if (isSmsInvalid) {
      CapNotification.error(errorMessage);
    }
  }
}
