mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix admin route
This commit is contained in:
parent
6fb884a212
commit
b1a50fbd73
2 changed files with 18 additions and 69 deletions
|
@ -1,5 +1,5 @@
|
|||
import React, { FunctionComponent, useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Outlet, useNavigate } from 'react-router-dom';
|
||||
|
||||
import alert from './alert';
|
||||
import { appRouter } from './appRouter';
|
||||
|
@ -33,7 +33,6 @@ type ConnectionRequiredProps = {
|
|||
* If a condition fails, this component will navigate to the appropriate page.
|
||||
*/
|
||||
const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
||||
children,
|
||||
isAdminRequired = false,
|
||||
isUserRequired = true
|
||||
}) => {
|
||||
|
@ -161,9 +160,7 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
|||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>{children}</>
|
||||
);
|
||||
return <Outlet />;
|
||||
};
|
||||
|
||||
export default ConnectionRequired;
|
||||
|
|
|
@ -14,70 +14,22 @@ import UserProfilesPage from './UserProfilesPage';
|
|||
const AppRoutes = () => (
|
||||
<Routes>
|
||||
<Route path='/'>
|
||||
<Route
|
||||
path='search.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<SearchPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='usernew.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<NewUserPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='userprofiles.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserProfilesPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='useredit.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserEditPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='userlibraryaccess.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserLibraryAccessPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='userparentalcontrol.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserParentalControl />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='userpassword.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserPasswordPage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path='myprofile.html'
|
||||
element={
|
||||
<ConnectionRequired>
|
||||
<UserProfilePage />
|
||||
</ConnectionRequired>
|
||||
}
|
||||
/>
|
||||
{/* User routes */}
|
||||
<Route path='/' element={<ConnectionRequired />}>
|
||||
<Route path='search.html' element={<SearchPage />} />
|
||||
<Route path='myprofile.html' element={<UserProfilePage />} />
|
||||
</Route>
|
||||
|
||||
{/* Admin routes */}
|
||||
<Route path='/' element={<ConnectionRequired isAdminRequired={true} />}>
|
||||
<Route path='usernew.html' element={<NewUserPage />} />
|
||||
<Route path='userprofiles.html' element={<UserProfilesPage />} />
|
||||
<Route path='useredit.html' element={<UserEditPage />} />
|
||||
<Route path='userlibraryaccess.html' element={<UserLibraryAccessPage />} />
|
||||
<Route path='userparentalcontrol.html' element={<UserParentalControl />} />
|
||||
<Route path='userpassword.html' element={<UserPasswordPage />} />
|
||||
</Route>
|
||||
|
||||
{/* Suppress warnings for unhandled routes */}
|
||||
<Route path='*' element={null} />
|
||||
</Route>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue