1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix double routing of root path

This commit is contained in:
Bill Thornton 2022-10-21 17:28:17 -04:00
parent 8af09253c8
commit c0662c80b7
4 changed files with 11 additions and 13 deletions

View file

@ -96,6 +96,9 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
}
const systemInfo = await infoResponse.json();
if (!systemInfo?.StartupWizardCompleted) {
// Update the current ApiClient
// TODO: Is there a better place to handle this?
ServerConnections.setLocalApiClient(firstConnection.ApiClient);
// Bounce to the wizard
console.info('[ConnectionRequired] startup wizard is not complete, redirecting there');
navigate(BounceRoutes.StartWizard);

View file

@ -412,11 +412,7 @@ class AppRouter {
if (apiClient && apiClient.isLoggedIn()) {
console.debug('[appRouter] user is authenticated');
if (route.isDefaultRoute) {
console.debug('[appRouter] loading home page');
this.goHome();
return;
} else if (route.roles) {
if (route.roles) {
this.#validateRoles(apiClient, route.roles).then(() => {
callback();
}, this.#beginConnectionWizard.bind(this));

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Route, Routes } from 'react-router-dom';
import { Navigate, Route, Routes } from 'react-router-dom';
import ConnectionRequired from '../components/ConnectionRequired';
import UserNew from './user/usernew';
@ -23,7 +23,7 @@ const AppRoutes = () => (
</Route>
{/* Admin routes */}
<Route path='/' element={<ConnectionRequired isAdminRequired={true} />}>
<Route path='/' element={<ConnectionRequired isAdminRequired />}>
<Route path='usernew.html' element={<UserNew />} />
<Route path='userprofiles.html' element={<UserProfiles />} />
<Route path='useredit.html' element={<UserEdit />} />
@ -32,6 +32,11 @@ const AppRoutes = () => (
<Route path='userpassword.html' element={<UserPassword />} />
</Route>
{/* Public routes */}
<Route path='/' element={<ConnectionRequired isUserRequired={false} />}>
<Route index element={<Navigate replace to='/home.html' />} />
</Route>
{/* Suppress warnings for unhandled routes */}
<Route path='*' element={null} />
</Route>

View file

@ -492,12 +492,6 @@ import { appRouter } from '../components/appRouter';
serverRequest: true
});
defineRoute({
path: '/',
autoFocus: false,
isDefaultRoute: true
});
console.groupEnd('defining core routes');
/* eslint-enable indent */