diff options
author | LASER-Yi <[email protected]> | 2021-09-03 09:35:46 +0800 |
---|---|---|
committer | LASER-Yi <[email protected]> | 2021-09-03 09:35:46 +0800 |
commit | 9901bf340019d431c1aaba69546589e73ccbd8f3 (patch) | |
tree | f4d7bb201f5648993cef5bb230deed62e7302437 /frontend | |
parent | 96a3acf8e945ca8a509a1b653a6d9d2622218eea (diff) | |
download | bazarr-9901bf340019d431c1aaba69546589e73ccbd8f3.tar.gz bazarr-9901bf340019d431c1aaba69546589e73ccbd8f3.zip |
Fix redirect issues when accessing root pathv0.9.9-beta.1
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/src/Navigation/RootRedirect.tsx | 19 | ||||
-rw-r--r-- | frontend/src/Navigation/index.ts | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/frontend/src/Navigation/RootRedirect.tsx b/frontend/src/Navigation/RootRedirect.tsx new file mode 100644 index 000000000..eec9a335d --- /dev/null +++ b/frontend/src/Navigation/RootRedirect.tsx @@ -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; diff --git a/frontend/src/Navigation/index.ts b/frontend/src/Navigation/index.ts index ee9e6d559..dbcb4db6a 100644 --- a/frontend/src/Navigation/index.ts +++ b/frontend/src/Navigation/index.ts @@ -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(); @@ -52,6 +53,12 @@ export function useNavigationItems() { routeOnly: true, }, { + name: "Redirect", + path: "/", + component: RootRedirect, + routeOnly: true, + }, + { icon: faPlay, name: "Series", path: "/series", |