import React, { useState } from 'react'; import { useRevokeAllUserKeysMutation } from 'librechat-data-provider/react-query'; import { OGDialogTemplate, Button, Label, OGDialog, OGDialogTrigger, Spinner, } from '@librechat/client'; import { useLocalize } from '~/hooks'; export const RevokeKeys = ({ disabled = false, setDialogOpen, }: { disabled?: boolean; setDialogOpen?: (open: boolean) => void; }) => { const localize = useLocalize(); const [open, setOpen] = useState(false); const revokeKeysMutation = useRevokeAllUserKeysMutation(); const handleSuccess = () => { if (!setDialogOpen) { return; } setDialogOpen(false); }; const onClick = () => { revokeKeysMutation.mutate({}, { onSuccess: handleSuccess }); }; const isLoading = revokeKeysMutation.isLoading; return (
{localize('com_ui_revoke_keys_confirm')} } selection={{ selectHandler: onClick, selectClasses: 'bg-destructive text-white transition-all duration-200 hover:bg-destructive/80', selectText: isLoading ? : localize('com_ui_revoke'), }} />
); };