Skip to content

Commit

Permalink
APPEALS-24727 Removed unnecessary props and comments. Refactored retr…
Browse files Browse the repository at this point in the history
…y button onclick
  • Loading branch information
msteele96 committed Aug 25, 2023
1 parent 1e03765 commit 4595025
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions client/app/queue/CreateMailTaskDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ export class CreateMailTaskDialog extends React.Component {
appealId={this.props.appealId}
requestType={this.state.selectedValue}
onChange={(value, valid) => this.setState({ eFolderUrl: value, eFolderUrlValid: valid })}
value={this.state.eFolderUrl}
valid={this.state.eFolderUrlValid}
/>
}
<TextareaField
Expand Down
15 changes: 9 additions & 6 deletions client/app/queue/components/EfolderUrlField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const EfolderUrlField = (props) => {
then((response) => {
if (response.body.document_presence === true) {
apiValidity = true;
// setValid(true);
setError('');
} else {
apiValidity = false;
Expand All @@ -49,7 +48,6 @@ const EfolderUrlField = (props) => {
}).
catch(() => {
apiValidity = false;
// setValid(false);
setError(COPY.EFOLDER_CONNECTION_ERROR);
}).
finally(() => {
Expand Down Expand Up @@ -79,6 +77,13 @@ const EfolderUrlField = (props) => {
setValid(newValidity);
}, 500);

const retryOnClick = async () => {
const retryValidity = await checkIfDocumentExists();

setValid(retryValidity);
props?.onChange?.(url, retryValidity);
};

useEffect(() => {
props?.onChange?.(url, false);
handleDebounce(url);
Expand All @@ -101,7 +106,7 @@ const EfolderUrlField = (props) => {
{
error === COPY.EFOLDER_CONNECTION_ERROR &&
<Button
onClick={() => checkIfDocumentExists()}
onClick={retryOnClick}
linkStyling
classNames={['cf-push-right', 'cf-retry']}>
Retry
Expand All @@ -113,9 +118,7 @@ const EfolderUrlField = (props) => {
EfolderUrlField.propTypes = {
appealId: PropTypes.string.isRequired,
requestType: PropTypes.string,
value: PropTypes.string,
errorMessage: PropTypes.string,
valid: PropTypes.bool
errorMessage: PropTypes.string
};

export default EfolderUrlField;

0 comments on commit 4595025

Please sign in to comment.