Skip to content

Commit

Permalink
fixed the way the 'share' function was getting the download url
Browse files Browse the repository at this point in the history
  • Loading branch information
jandsonrj committed Aug 2, 2023
1 parent 3620dcc commit f2eaaf9
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions frontend/components/ProductGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ export default function ProductGrid(props) {
}, [])

const columns = React.useMemo(() => {
const getDownloadUrl = row => {
const { id, /* eslint-disable camelcase */ display_name } = row

const formattedDisplayName = display_name
.replace(/[-\s]/g, '')
.toLowerCase()

const productUrl = getProductUrl(`${id}_${formattedDisplayName}`)
const downloadUrl = `${window.location.origin}${productUrl}`
return downloadUrl
}

const handleDownload = row => {
router.push(getProductUrl(row.internal_name))
}
Expand All @@ -90,8 +78,9 @@ export default function ProductGrid(props) {
}

const handleShare = row => {
const downloadUrl = getDownloadUrl(row)
setSelectedFileUrl(downloadUrl)
const productUrl = getProductUrl(row.internal_name)
const shareUrl = `${window.location.origin}${productUrl}`
setSelectedFileUrl(shareUrl)
setSnackbarOpen(true)
}

Expand Down

0 comments on commit f2eaaf9

Please sign in to comment.