github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/pages/downloads/index.jsx (about)

     1  import VERSION from 'data/version.js'
     2  import ProductDownloader from '@hashicorp/react-product-downloader'
     3  import Head from 'next/head'
     4  import HashiHead from '@hashicorp/react-head'
     5  
     6  export default function DownloadsPage({ releaseData }) {
     7    return (
     8      <div id="p-downloads" className="g-container">
     9        <HashiHead is={Head} title="Downloads | Nomad by HashiCorp" />
    10        <ProductDownloader
    11          product="Nomad"
    12          version={VERSION}
    13          releaseData={releaseData}
    14          community="/resources"
    15        />
    16      </div>
    17    )
    18  }
    19  
    20  export async function getStaticProps() {
    21    return fetch(`https://releases.hashicorp.com/nomad/${VERSION}/index.json`)
    22      .then((res) => res.json())
    23      .then((releaseData) => ({ props: { releaseData } }))
    24      .catch(() => {
    25        throw new Error(
    26          `--------------------------------------------------------
    27          Unable to resolve version ${VERSION} on releases.hashicorp.com from link
    28          <https://releases.hashicorp.com/nomad/${VERSION}/index.json>. Usually this
    29          means that the specified version has not yet been released. The downloads page
    30          version can only be updated after the new version has been released, to ensure
    31          that it works for all users.
    32          ----------------------------------------------------------`
    33        )
    34      })
    35  }