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 Mar 25, 2024
1 parent cee22f4 commit 307516d
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,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 307516d

Please sign in to comment.