fix vmware downloads page (#11697)

This commit is contained in:
Jeff Escalante 2020-06-11 19:57:44 -04:00 committed by GitHub
parent ba721197ab
commit 45be90fec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ import ProductDownloader from '@hashicorp/react-product-downloader'
import Head from 'next/head'
import HashiHead from '@hashicorp/react-head'
export default function DownloadsPage({ downloadData }) {
export default function DownloadsPage({ releaseData }) {
return (
<div className={s.root}>
<HashiHead
@ -15,7 +15,7 @@ export default function DownloadsPage({ downloadData }) {
product="Vagrant VMWare Utility"
baseProduct="Vagrant"
version={VMWARE_UTILITY_VERSION}
downloads={downloadData}
releaseData={releaseData}
changelog={false}
/>
</div>
@ -26,16 +26,8 @@ export async function getStaticProps() {
return fetch(
`https://releases.hashicorp.com/vagrant-vmware-utility/${VMWARE_UTILITY_VERSION}/index.json`
)
.then((r) => r.json())
.then((r) => {
// TODO: restructure product-downloader to run this logic internally
return r.builds.reduce((acc, build) => {
if (!acc[build.os]) acc[build.os] = {}
acc[build.os][build.arch] = build.url
return acc
}, {})
})
.then((r) => ({ props: { downloadData: r } }))
.then((res) => res.json())
.then((releaseData) => ({ props: { releaseData } }))
.catch(() => {
throw new Error(
`--------------------------------------------------------