chore: reduce release name & version to a single request

This commit is contained in:
Nicolás Quiroz 2022-11-17 00:14:43 -03:00
parent 5d61fc3219
commit 832ad6bab0
1 changed files with 8 additions and 7 deletions

View File

@ -29,14 +29,15 @@ import { pgpBuildTestData } from '../data/test/pgpbuild-testdata';
import { pgpDeveloperTestData } from '../data/test/pgpdeveloper-testdata'; import { pgpDeveloperTestData } from '../data/test/pgpdeveloper-testdata';
export const getServerSideProps: GetServerSideProps = async () => { export const getServerSideProps: GetServerSideProps = async () => {
// Latest release version number // Latest release name & version number
const versionNumber = await fetch(LATEST_GETH_RELEASE_URL) const { versionNumber, releaseName } = await fetch(LATEST_GETH_RELEASE_URL)
.then(response => response.json()) .then(response => response.json())
.then(release => release.tag_name); .then(release => {
// Latest release name return {
const releaseName = await fetch(LATEST_GETH_RELEASE_URL) versionNumber: release.tag_name,
.then(response => response.json()) releaseName: release.name
.then(release => release.name); };
});
// Latest release commit hash // Latest release commit hash
const commit = await fetch(`${ALL_GETH_COMMITS_URL}/${versionNumber}`) const commit = await fetch(`${ALL_GETH_COMMITS_URL}/${versionNumber}`)
.then(response => response.json()) .then(response => response.json())