mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
fix: a condition is added for the reason in the handler
This commit is contained in:
@ -34,13 +34,15 @@ export const SuperDeleteDocumentDialog = ({ document }: SuperDeleteDocumentDialo
|
||||
|
||||
const handleDeleteDocument = async () => {
|
||||
try {
|
||||
await deleteDocument({ id: document.id, userId: document.userId, reason });
|
||||
toast({
|
||||
title: 'Document deleted',
|
||||
description: 'The Document has been deleted successfully.',
|
||||
duration: 5000,
|
||||
});
|
||||
router.push('/admin/documents');
|
||||
if (reason) {
|
||||
await deleteDocument({ id: document.id, userId: document.userId, reason });
|
||||
toast({
|
||||
title: 'Document deleted',
|
||||
description: 'The Document has been deleted successfully.',
|
||||
duration: 5000,
|
||||
});
|
||||
router.push('/admin/documents');
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof TRPCClientError && err.data?.code === 'BAD_REQUEST') {
|
||||
toast({
|
||||
|
||||
Reference in New Issue
Block a user