mirror of
https://github.com/morpheus65535/bazarr
synced 2025-03-15 00:18:48 +00:00
Fix redirect issues when accessing root path
This commit is contained in:
parent
96a3acf8e9
commit
9901bf3400
2 changed files with 26 additions and 0 deletions
19
frontend/src/Navigation/RootRedirect.tsx
Normal file
19
frontend/src/Navigation/RootRedirect.tsx
Normal file
|
@ -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…
Add table
Reference in a new issue