Fix redirect issues when accessing root path

pull/1527/head v0.9.9-beta.1
LASER-Yi 3 years ago
parent 96a3acf8e9
commit 9901bf3400
No known key found for this signature in database
GPG Key ID: F5CDE034FD72708F

@ -0,0 +1,19 @@
import { FunctionComponent } from "react";
import { Redirect } from "react-router-dom";
import { useIsRadarrEnabled, useIsSonarrEnabled } from "../@redux/hooks";
const RootRedirect: FunctionComponent = () => {
const sonarr = useIsSonarrEnabled();
const radarr = useIsRadarrEnabled();
let path = "/settings";
if (sonarr) {
path = "/series";
} else if (radarr) {
path = "movies";
}
return <Redirect to={path}></Redirect>;
};
export default RootRedirect;

@ -37,6 +37,7 @@ import SystemTasksView from "../System/Tasks";
import WantedMoviesView from "../Wanted/Movies";
import WantedSeriesView from "../Wanted/Series";
import { Navigation } from "./nav";
import RootRedirect from "./RootRedirect";
export function useNavigationItems() {
const sonarr = useIsSonarrEnabled();
@ -51,6 +52,12 @@ export function useNavigationItems() {
component: EmptyPage,
routeOnly: true,
},
{
name: "Redirect",
path: "/",
component: RootRedirect,
routeOnly: true,
},
{
icon: faPlay,
name: "Series",

Loading…
Cancel
Save