Skip to content

Commit

Permalink
hotfix/deploy-api-urls (#100)
Browse files Browse the repository at this point in the history
* fix double preprend api version

* moved the v1 preprend in apiUtils

* fix
  • Loading branch information
baktun14 authored Feb 15, 2024
1 parent fad3169 commit d0d1908
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion deploy-web/src/pages/providers/[owner]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
50 changes: 25 additions & 25 deletions deploy-web/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions deploy-web/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit d0d1908

Please sign in to comment.