Update src/components/forms/document/EditPublishedDocumentForm.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Austin Kelsay 2025-02-27 11:46:33 -06:00 committed by GitHub
parent eaa2b77e06
commit b683089934
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,9 +81,15 @@ const EditPublishedDocumentForm = ({ event }) => {
// Encrypt content if it's a paid resource
let finalContent = content;
if (isPaidResource && price > 0) {
finalContent = await encryptContent(content);
if (!finalContent) {
showToast('error', 'Error', 'Failed to encrypt content');
try {
finalContent = await encryptContent(content);
if (!finalContent) {
showToast('error', 'Error', 'Failed to encrypt content');
return;
}
} catch (error) {
console.error('Encryption error:', error);
showToast('error', 'Error', 'Failed to encrypt content: ' + error.message);
return;
}
}