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 React, { FunctionComponent, useEffect, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { Outlet, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import alert from './alert';
|
import alert from './alert';
|
||||||
import { appRouter } from './appRouter';
|
import { appRouter } from './appRouter';
|
||||||
|
@ -33,7 +33,6 @@ type ConnectionRequiredProps = {
|
||||||
* If a condition fails, this component will navigate to the appropriate page.
|
* If a condition fails, this component will navigate to the appropriate page.
|
||||||
*/
|
*/
|
||||||
const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
||||||
children,
|
|
||||||
isAdminRequired = false,
|
isAdminRequired = false,
|
||||||
isUserRequired = true
|
isUserRequired = true
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -161,9 +160,7 @@ const ConnectionRequired: FunctionComponent<ConnectionRequiredProps> = ({
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <Outlet />;
|
||||||
<>{children}</>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ConnectionRequired;
|
export default ConnectionRequired;
|
||||||
|
|
|
@ -14,70 +14,22 @@ import UserProfilesPage from './UserProfilesPage';
|
||||||
const AppRoutes = () => (
|
const AppRoutes = () => (
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path='/'>
|
<Route path='/'>
|
||||||
<Route
|
{/* User routes */}
|
||||||
path='search.html'
|
<Route path='/' element={<ConnectionRequired />}>
|
||||||
element={
|
<Route path='search.html' element={<SearchPage />} />
|
||||||
<ConnectionRequired>
|
<Route path='myprofile.html' element={<UserProfilePage />} />
|
||||||
<SearchPage />
|
</Route>
|
||||||
</ConnectionRequired>
|
|
||||||
}
|
{/* Admin routes */}
|
||||||
/>
|
<Route path='/' element={<ConnectionRequired isAdminRequired={true} />}>
|
||||||
<Route
|
<Route path='usernew.html' element={<NewUserPage />} />
|
||||||
path='usernew.html'
|
<Route path='userprofiles.html' element={<UserProfilesPage />} />
|
||||||
element={
|
<Route path='useredit.html' element={<UserEditPage />} />
|
||||||
<ConnectionRequired>
|
<Route path='userlibraryaccess.html' element={<UserLibraryAccessPage />} />
|
||||||
<NewUserPage />
|
<Route path='userparentalcontrol.html' element={<UserParentalControl />} />
|
||||||
</ConnectionRequired>
|
<Route path='userpassword.html' element={<UserPasswordPage />} />
|
||||||
}
|
</Route>
|
||||||
/>
|
|
||||||
<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>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
{/* Suppress warnings for unhandled routes */}
|
{/* Suppress warnings for unhandled routes */}
|
||||||
<Route path='*' element={null} />
|
<Route path='*' element={null} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue