From d0d19086a1e74f109c338182a2a39cfee7eba4bc Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:52:22 -0500 Subject: [PATCH] hotfix/deploy-api-urls (#100) * fix double preprend api version * moved the v1 preprend in apiUtils * fix --- .../src/pages/providers/[owner]/index.tsx | 2 +- deploy-web/src/utils/apiUtils.ts | 50 +++++++++---------- deploy-web/src/utils/constants.ts | 8 +-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/deploy-web/src/pages/providers/[owner]/index.tsx b/deploy-web/src/pages/providers/[owner]/index.tsx index 7536d52e3..b6b5da2bd 100644 --- a/deploy-web/src/pages/providers/[owner]/index.tsx +++ b/deploy-web/src/pages/providers/[owner]/index.tsx @@ -242,7 +242,7 @@ export default ProviderDetailPage; export async function getServerSideProps({ params, query }) { const apiUrl = getNetworkBaseApiUrl(query.network as string); - const response = await axios.get(`${apiUrl}/providers/${params?.owner}`); + const response = await axios.get(`${apiUrl}/v1/providers/${params?.owner}`); return { props: { diff --git a/deploy-web/src/utils/apiUtils.ts b/deploy-web/src/utils/apiUtils.ts index 45c8437c4..18b2cb78e 100644 --- a/deploy-web/src/utils/apiUtils.ts +++ b/deploy-web/src/utils/apiUtils.ts @@ -19,13 +19,13 @@ export class ApiUrlService { return `${apiEndpoint}/akash/provider/${networkVersion}/providers`; } static providerList() { - return `${BASE_API_URL}/providers`; + return `${BASE_API_URL}/v1/providers`; } static providerDetail(owner: string) { - return `${BASE_API_URL}/providers/${owner}`; + return `${BASE_API_URL}/v1/providers/${owner}`; } static providerRegions() { - return `${BASE_API_URL}/provider-regions`; + return `${BASE_API_URL}/v1/provider-regions`; } static block(apiEndpoint: string, id: string) { return `${apiEndpoint}/blocks/${id}`; @@ -58,71 +58,71 @@ export class ApiUrlService { return `${apiEndpoint}/cosmos/feegrant/v1beta1/allowances/${address}`; } static dashboardData() { - return `${BASE_API_URL}/dashboard-data`; + return `${BASE_API_URL}/v1/dashboard-data`; } static marketData() { - return `${BASE_API_URL}/market-data`; + return `${BASE_API_URL}/v1/market-data`; } static proposals() { - return `${BASE_API_URL}/proposals`; + return `${BASE_API_URL}/v1/proposals`; } static apiProviders() { - return `${BASE_API_URL}/providers`; + return `${BASE_API_URL}/v1/providers`; } static templates() { - return `${BASE_API_URL}/templates`; + return `${BASE_API_URL}/v1/templates`; } static validators() { - return `${BASE_API_URL}/validators`; + return `${BASE_API_URL}/v1/validators`; } static transactions(limit: number) { - return `${BASE_API_URL}/transactions${appendSearchParams({ limit })}`; + return `${BASE_API_URL}/v1/transactions${appendSearchParams({ limit })}`; } static addressTransactions(address: string, skip: number, limit: number) { - return `${BASE_API_URL}/addresses/${address}/transactions/${skip}/${limit}`; + return `${BASE_API_URL}/v1/addresses/${address}/transactions/${skip}/${limit}`; } static addressDeployments(address: string, skip: number, limit: number, reverseSorting: boolean, filters: { [key: string]: string }) { - return `${BASE_API_URL}/addresses/${address}/deployments/${skip}/${limit}${appendSearchParams({ reverseSorting, ...filters })}`; + return `${BASE_API_URL}/v1/addresses/${address}/deployments/${skip}/${limit}${appendSearchParams({ reverseSorting, ...filters })}`; } static graphData(snapshot: string) { - return `${BASE_API_URL}/graph-data/${snapshot}`; + return `${BASE_API_URL}/v1/graph-data/${snapshot}`; } static providerGraphData(snapshot: string) { - return `${BASE_API_URL}/provider-graph-data/${snapshot}`; + return `${BASE_API_URL}/v1/provider-graph-data/${snapshot}`; } static blocks(limit: number) { - return `${BASE_API_URL}/blocks${appendSearchParams({ limit })}`; + return `${BASE_API_URL}/v1/blocks${appendSearchParams({ limit })}`; } static providerActiveLeasesGraph(providerAddress: string) { - return `${BASE_API_URL}/provider-active-leases-graph-data/${providerAddress}`; + return `${BASE_API_URL}/v1/provider-active-leases-graph-data/${providerAddress}`; } static providerAttributesSchema() { - return `${BASE_API_URL}/provider-attributes-schema`; + return `${BASE_API_URL}/v1/provider-attributes-schema`; } static networkCapacity() { - return `${BASE_API_URL}/network-capacity`; + return `${BASE_API_URL}/v1/network-capacity`; } // Github static auditors() { - return `${BASE_API_URL}/auditors`; + return `${BASE_API_URL}/v1/auditors`; } static mainnetNodes() { - return `${BASE_API_URL}/nodes/mainnet`; + return `${BASE_API_URL}/v1/nodes/mainnet`; } static testnetNodes() { - return `${BASE_API_URL}/nodes/testnet`; + return `${BASE_API_URL}/v1/nodes/testnet`; } static sandboxNodes() { - return `${BASE_API_URL}/nodes/sandbox`; + return `${BASE_API_URL}/v1/nodes/sandbox`; } static mainnetVersion() { - return `${BASE_API_URL}/version/mainnet`; + return `${BASE_API_URL}/v1/version/mainnet`; } static testnetVersion() { - return `${BASE_API_URL}/version/testnet`; + return `${BASE_API_URL}/v1/version/testnet`; } static sandboxVersion() { - return `${BASE_API_URL}/version/sandbox`; + return `${BASE_API_URL}/v1/version/sandbox`; } } diff --git a/deploy-web/src/utils/constants.ts b/deploy-web/src/utils/constants.ts index 660a78c74..3bbf8e827 100644 --- a/deploy-web/src/utils/constants.ts +++ b/deploy-web/src/utils/constants.ts @@ -33,16 +33,16 @@ export const BASE_API_MAINNET_URL = getApiMainnetUrl(); export const BASE_API_TESTNET_URL = getApiTestnetUrl(); export const BASE_API_SANDBOX_URL = getApiSandboxUrl(); -export const BASE_API_URL = getApiUrl() + "/v1"; +export const BASE_API_URL = getApiUrl(); export function getNetworkBaseApiUrl(network: string) { switch (network) { case testnetId: - return BASE_API_TESTNET_URL + "/v1"; + return BASE_API_TESTNET_URL; case sandboxId: - return BASE_API_SANDBOX_URL + "/v1"; + return BASE_API_SANDBOX_URL; default: - return BASE_API_MAINNET_URL + "/v1"; + return BASE_API_MAINNET_URL; } }