Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
nu_link committed Jul 15, 2023
1 parent 63a2fe3 commit a300220
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { setIPFSNodeUrl } from "@/utils/ipfs";
import { repeatInterval } from "@/utils/repeatInterval";
import Emitter from "@/lib/emitter";
import { USERINFO_UPDATE } from "@/lib/emitter-events";
import { connect, setNetWorkChainId, getNetWorkChainId } from "@nulink_network/nulink-web-agent-access-sdk";
import {
connect,
setNetWorkChainId,
getNetWorkChainId,
} from "@nulink_network/nulink-web-agent-access-sdk";

enum NETWORK_LIST {
Horus = "Horus",
Expand Down Expand Up @@ -60,8 +64,13 @@ export const Header = ({ setLoginUser, setLoginStatus }) => {
const _changeNetwork = async () => {
if (selectNetworkConfig && selectNetworkConfig.key) {
setShowConfirmTipModal(false);
await setNetWorkChainId(selectNetworkConfig.value);
await _fetchData();
localStorage.setItem(
"nulink_agent_react_chain_id",
selectNetworkConfig.value,
);
window.location.reload()
// await setNetWorkChainId(selectNetworkConfig.value);
// await _fetchData();
}
};

Expand Down Expand Up @@ -116,7 +125,8 @@ export const Header = ({ setLoginUser, setLoginStatus }) => {
};

const _fetchData = async () => {
setChainID(await getNetWorkChainId());
// setChainID(await getNetWorkChainId());
setChainID(Number(localStorage.getItem("nulink_agent_react_chain_id")));
};

useEffect(() => {
Expand Down

0 comments on commit a300220

Please sign in to comment.