diff --git a/src/components/MovieDetails/index.tsx b/src/components/MovieDetails/index.tsx index e8bb3f38d..77f26f790 100644 --- a/src/components/MovieDetails/index.tsx +++ b/src/components/MovieDetails/index.tsx @@ -522,7 +522,7 @@ const MovieDetails: React.FC = ({ movie }) => { ( = ({ tv }) => { ( = ({ }) => { const { user, error, revalidate } = useUser({ initialData: initialUser }); const router = useRouter(); + const routing = useRef(false); useEffect(() => { revalidate(); }, [router.pathname, revalidate]); useEffect(() => { - let routing = false; - if ( !router.pathname.match(/(setup|login)/) && (!user || error) && - !routing + !routing.current ) { - routing = true; + routing.current = true; location.href = '/login'; } }, [router, user, error]); diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 32c054475..f2c71cf0a 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -100,13 +100,11 @@ CoreApp.getInitialProps = async (initialProps) => { if (ctx.res) { // Check if app is initialized and redirect if necessary - let initialized = true; - const response = await axios.get<{ initialized: boolean }>( `http://localhost:${process.env.PORT || 3000}/api/v1/settings/public` ); - initialized = response.data.initialized; + const initialized = response.data.initialized; if (!initialized) { if (!router.pathname.match(/(setup|login\/plex)/)) {