From 83003759df35a5c4246d241edb29b6f11623490a Mon Sep 17 00:00:00 2001 From: fearlessfe <505380967@qq.com> Date: Sun, 25 Aug 2024 16:06:25 +0800 Subject: [PATCH] fix: network switch --- .github/workflows/docker-build.yml | 2 ++ src/components/NavMenusSection/index.tsx | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index c01bb23..d1785f7 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - "development" + types: + - closed jobs: build: diff --git a/src/components/NavMenusSection/index.tsx b/src/components/NavMenusSection/index.tsx index 167fe15..6ba8a68 100644 --- a/src/components/NavMenusSection/index.tsx +++ b/src/components/NavMenusSection/index.tsx @@ -19,25 +19,29 @@ export const NavMenusSection: React.FC = () => { const handleSelectNetwork = (e: Network) => { const { origin } = networkConfigs[e]; - if (origin.includes(window.location.origin)) return; - window.open(origin); + // window.open(origin); + if (origin.includes(window.location.host)) return; + const target = `${window.location.protocol}//${origin}`; + window.location.href = target; }; return (