fix: routing fix

pull/38/head
VPcodebase 3 years ago
parent 785b2b2ff3
commit a0bcf08a4f
  1. 2
      src/Routes.tsx
  2. 31
      src/pages/AddressPage/index.tsx

@ -55,7 +55,7 @@ export function Routes() {
<StakingTransactionPage />
</Route>
<Route path="/address/:id">
<Route exact path="/address/:id">
<AddressPage />
</Route>

@ -31,11 +31,38 @@ import { useCurrency } from "src/hooks/ONE-ETH-SwitcherHook";
export function AddressPage() {
const history = useHistory();
const tabParamName = "activeTab=";
const oldTabParamName = "txType=";
let activeTab = 0;
try {
activeTab = +history.location.search.slice(
const newValue = +history.location.search.slice(
history.location.search.indexOf("activeTab=") + tabParamName.length
);
const oldTxType = history.location.search.slice(
history.location.search.indexOf(oldTabParamName) + oldTabParamName.length
);
activeTab = isNaN(newValue) ? 0 : newValue;
switch (oldTxType) {
case "regular": {
activeTab = 0;
break;
}
case "staking": {
activeTab = 1;
break;
}
case "hrc20": {
activeTab = 3;
break;
}
default: {
}
}
} catch {
activeTab = 0;
}
@ -54,7 +81,7 @@ export function AddressPage() {
//TODO remove hardcode
// @ts-ignore
let { id } = useParams();
id = `${id}`.toLowerCase()
id = `${id}`.toLowerCase();
id = id.slice(0, 3) === "one" ? getAddress(id).basicHex : id;
const erc20Token = erc20Map[id] || null;

Loading…
Cancel
Save