2022-03-03 03:37:56 +03:00
|
|
|
import React, { FunctionComponent, useCallback, useEffect, useState } from 'react';
|
2022-01-05 20:35:58 +03:00
|
|
|
import SectionTabs from '../dashboard/users/SectionTabs';
|
|
|
|
import UserPasswordForm from '../dashboard/users/UserPasswordForm';
|
2022-04-11 11:20:53 -04:00
|
|
|
import { getParameterByName } from '../../utils/url';
|
2022-01-05 21:53:15 +03:00
|
|
|
import SectionTitleContainer from '../dashboard/users/SectionTitleContainer';
|
2022-01-05 20:35:58 +03:00
|
|
|
|
|
|
|
const UserPasswordPage: FunctionComponent = () => {
|
2022-04-11 11:20:53 -04:00
|
|
|
const userId = getParameterByName('userId');
|
2022-01-05 20:35:58 +03:00
|
|
|
const [ userName, setUserName ] = useState('');
|
|
|
|
|
2022-03-03 03:37:56 +03:00
|
|
|
const loadUser = useCallback(() => {
|
|
|
|
window.ApiClient.getUser(userId).then(function (user) {
|
|
|
|
if (!user.Name) {
|
|
|
|
throw new Error('Unexpected null user.Name');
|
|
|
|
}
|
2022-01-05 20:35:58 +03:00
|
|
|
setUserName(user.Name);
|
|
|
|
});
|
|
|
|
}, [userId]);
|
2022-03-03 03:37:56 +03:00
|
|
|
useEffect(() => {
|
|
|
|
loadUser();
|
|
|
|
}, [loadUser]);
|
2022-01-05 20:35:58 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className='content-primary'>
|
2022-05-07 23:27:33 +03:00
|
|
|
<SectionTitleContainer
|
|
|
|
title={userName}
|
|
|
|
titleLink='https://docs.jellyfin.org/general/server/users/'
|
|
|
|
/>
|
2022-01-05 20:35:58 +03:00
|
|
|
<SectionTabs activeTab='userpassword'/>
|
|
|
|
<div className='readOnlyContent'>
|
|
|
|
<UserPasswordForm
|
|
|
|
userId={userId}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default UserPasswordPage;
|