All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.tile.DownloadFilesButton.js Maven / Gradle / Ivy

There is a newer version: 0.80.3
Show newest version
import { IconButton, Tooltip } from '@mui/material';
import { useNotifier } from 'hooks/notification';
import { authorizedDownloadAll } from 'utils/download';
import { Download as DownloadIcon } from '@mui/icons-material';
import { SERVER } from 'helpers/runtime';


const DownloadFilesButton = ({attachments}) => {
  const notifier = useNotifier()
  const onClick = (e) => {
    e.preventDefault()
    e.stopPropagation()
    authorizedDownloadAll(attachments.map(attachment => ({...attachment, url: createRemoteContentUrl(attachment.__id)})), notifier)
  }

  return (
    
      
        
          
        
      
    
  )
}

export function createRemoteContentUrl(id) {
  return SERVER + 'content/'  + id
}

export default DownloadFilesButton




© 2015 - 2024 Weber Informatics LLC | Privacy Policy