Explorer: Disable cluster url replacement on localhost (#28385)
This commit is contained in:
parent
dd7fee8f32
commit
f627b7d826
|
@ -61,13 +61,21 @@ export const TESTNET_URL = clusterApiUrl("testnet");
|
|||
export const DEVNET_URL = clusterApiUrl("devnet");
|
||||
|
||||
export function clusterUrl(cluster: Cluster, customUrl: string): string {
|
||||
const modifyUrl = (url: string): string => {
|
||||
if (window.location.hostname === "localhost") {
|
||||
return url;
|
||||
} else {
|
||||
return url.replace("api", "explorer-api");
|
||||
}
|
||||
};
|
||||
|
||||
switch (cluster) {
|
||||
case Cluster.Devnet:
|
||||
return DEVNET_URL.replace("api", "explorer-api");
|
||||
return modifyUrl(DEVNET_URL);
|
||||
case Cluster.MainnetBeta:
|
||||
return MAINNET_BETA_URL.replace("api", "explorer-api");
|
||||
return modifyUrl(MAINNET_BETA_URL);
|
||||
case Cluster.Testnet:
|
||||
return TESTNET_URL.replace("api", "explorer-api");
|
||||
return modifyUrl(TESTNET_URL);
|
||||
case Cluster.Custom:
|
||||
return customUrl;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue