Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ircfspace committed Mar 5, 2024
1 parent f8ff31c commit 96f3152
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { allIps } from "~/consts";
import { useUserIPInfo } from "~/hooks/useUserIPInfo";
import { toast } from "react-hot-toast";
import { useEffect, useState } from "react";
import { useRouter } from 'next/router';
const UserIP = dynamic(() => import("~/components/UserIP"), { ssr: false });

const Home: NextPage = () => {
Expand Down Expand Up @@ -51,6 +52,13 @@ const Home: NextPage = () => {
setLoaded(true);
}, []);

const router = useRouter();
useEffect(() => {
if (window.location.protocol === 'https:') {
window.location.href = `http://${window.location.host}${router.asPath}`;
}
}, []);

if (!loaded) return;

return (
Expand Down

0 comments on commit 96f3152

Please sign in to comment.