Skip to content

Commit

Permalink
STCOR-794: Disable Continue button when no tenant selected (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandberger committed May 15, 2024
1 parent 2659e82 commit 602d21f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/PreLoginLanding/PreLoginLanding.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useRef } from 'react';
import { Button, Select, Col, Row } from '@folio/stripes-components';
import { useIntl } from 'react-intl';
import PropTypes from 'prop-types';
Expand All @@ -21,8 +21,11 @@ function PreLoginLanding({ onSelectTenant }) {
return '';
};

const submitButtonRef = useRef({ disabled: true });

const handleChangeTenant = (e) => {
const tenantName = e.target.value;
submitButtonRef.current.disabled = !tenantName;
if (tenantName === '') {
onSelectTenant('', '');
return;
Expand Down Expand Up @@ -50,7 +53,8 @@ function PreLoginLanding({ onSelectTenant }) {
/>
<Button
buttonClass={styles.submitButton}
disabled={!okapi.tenant}
disabled={submitButtonRef.current.disabled}
ref={submitButtonRef}
onClick={() => window.location.assign(getLoginUrl())}
buttonStyle="primary"
fullWidth
Expand Down

0 comments on commit 602d21f

Please sign in to comment.