Skip to content

Commit

Permalink
Fix: Indentation Issue
Browse files Browse the repository at this point in the history
Simplified the logic
  • Loading branch information
BLasan committed Apr 18, 2024
1 parent bc858ac commit 60ef32d
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,16 @@ const UploadPolicyDropzone: FC<UploadPolicyDropzoneProps> = ({
const intl = useIntl();

const handleDrop = (policyDefinition: any) => {
if(policyDefinition===null || policyDefinition===undefined) {
APIMAlert.error(intl.formatMessage({
id: 'Uploading.Policies.Error',
defaultMessage: 'Incompatible file type',
}));
}
if (policyDefinition[0].name.endsWith('.j2') || policyDefinition[0].name.endsWith('.xml')) {
if (policyDefinition && policyDefinition[0] &&
(policyDefinition[0].name.endsWith('.j2') ||
policyDefinition[0].name.endsWith('.xml'))) {
setPolicyDefinitionFile(policyDefinition);
} else {
APIMAlert.error(intl.formatMessage({
id: 'Uploading.Policies.Error',
defaultMessage: 'Incompatible file type',
}));
return;
}
APIMAlert.error(intl.formatMessage({
id: 'Uploading.Policies.Error',
defaultMessage: 'Incompatible file type',
}));
};

const renderPolicyFileDropzone = () => {
Expand Down

0 comments on commit 60ef32d

Please sign in to comment.