Files
pterodactyl-panel/resources/scripts/components/server/databases/RotatePasswordButton.tsx
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

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;