ryoji-s 2 lat temu
rodzic
commit
6daa4b7dfe
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      packages/ui/src/components/Attachment.tsx

+ 4 - 2
packages/ui/src/components/Attachment.tsx

@@ -5,7 +5,7 @@ import { UserPicture } from './User/UserPicture';
 type AttachmentProps = {
   attachment: IAttachmentHasId,
   inUse: boolean,
-  onAttachmentDeleteClicked: (attachment: IAttachmentHasId) => void,
+  onAttachmentDeleteClicked?: (attachment: IAttachmentHasId) => void,
   isUserLoggedIn?: boolean,
 };
 
@@ -16,7 +16,9 @@ export const Attachment = (props: AttachmentProps): JSX.Element => {
   } = props;
 
   const _onAttachmentDeleteClicked = () => {
-    onAttachmentDeleteClicked(attachment);
+    if (onAttachmentDeleteClicked != null) {
+      onAttachmentDeleteClicked(attachment);
+    }
   };
 
   const formatIcon = (attachment.fileFormat.match(/image\/.+/i)) ? 'icon-picture' : 'icon-doc';