mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
29 lines
821 B
TypeScript
29 lines
821 B
TypeScript
import { useCurrentServerUuid } from '@/api/server/queries';
|
|
import { rotateServerDatabasePasswordInput, useRotateDatabasePassword } from '@/api/server/databases/queries';
|
|
import Button from '@/components/elements/Button';
|
|
|
|
type Props = {
|
|
databaseId: string;
|
|
};
|
|
|
|
const RotatePasswordButton = ({ databaseId }: Props) => {
|
|
const uuid = useCurrentServerUuid()!;
|
|
const rotatePassword = useRotateDatabasePassword();
|
|
|
|
if (!databaseId) {
|
|
return null;
|
|
}
|
|
|
|
const rotate = () => {
|
|
rotatePassword.mutate(rotateServerDatabasePasswordInput(uuid, databaseId));
|
|
};
|
|
|
|
return (
|
|
<Button isSecondary color={'primary'} className={'mr-2'} onClick={rotate} isLoading={rotatePassword.isPending}>
|
|
Rotate Password
|
|
</Button>
|
|
);
|
|
};
|
|
|
|
export default RotatePasswordButton;
|