import {useAuth} from "../../hooks/authenticationHook"; import {useMetadata} from "../../hooks/metadataHook"; import {Navigate} from "react-router-dom"; import React, {useEffect, useState} from "react"; import {staticSite} from "../../service/backendConfiguration"; const RedirectPlaceholder = () => { const [redirectStart] = useState(Date.now()) const [dateDiff, setDateDiff] = useState(0) useEffect(() => { const interval = setInterval(() => { if (dateDiff <= 50) { setDateDiff(Date.now() - redirectStart); } else { clearInterval(interval); } }, 500); return () => clearInterval(interval); }, [redirectStart, dateDiff]) if (dateDiff > 50) { return <>
Redirecting..
This is taking longer than expected.
Make sure the Plan webserver is enabled.
(This page can show up if the Plan webserver goes
offline.)
If you are trying to set up a development environment, change package.json "proxy" to address of your Plan webserver.
Redirecting..
> } } const MainPageRedirect = () => { const {authLoaded, authRequired, loggedIn, user} = useAuth(); const {isProxy, serverName, serverUUID} = useMetadata(); if (staticSite) { const urlParams = new URLSearchParams(window.location.search); const redirect = urlParams.get('redirect'); if (redirect) { return (