Explorar el Código

fix: 修改路由白名单

Before hace 7 meses
padre
commit
0d37328a64
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      src/components/Card/Card.tsx

+ 4 - 1
src/components/Card/Card.tsx

@@ -56,7 +56,10 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                 if (res.data && res.data.game_url) {
                     const url = `${res.data?.game_url}&brand=${brandRef.current}&return_url=${process.env.NEXT_PUBLIC_SHARE_URL}`;
                     const protocol = new URL(url).protocol;
-                    if (whiteUrls.indexOf(window.location.hostname) || protocol === "https:") {
+                    if (
+                        whiteUrls.indexOf(window.location.hostname) !== -1 ||
+                        protocol === "https:"
+                    ) {
                         router.push(`/game?${url}`);
                     } else {
                         window.open(url);