add attachment in reply

This commit is contained in:
hamid zarghami
2025-11-29 16:38:32 +03:30
parent dbe28c3b5f
commit a0ea1e1fb5
2 changed files with 16 additions and 1 deletions
+6 -1
View File
@@ -1,7 +1,7 @@
import { useState } from "react";
import { useAuthStore } from "@/pages/auth/store/AuthStore";
import { useSendEmail } from "@/pages/received/hooks/useEmailData";
import { SendEmailDto } from "@/pages/received/types/Types";
import { SendEmailDto, EmailAttachmentDto } from "@/pages/received/types/Types";
import { MessageDetail } from "@/pages/received/types/Types";
import { toast } from "@/components/Toast";
@@ -19,12 +19,14 @@ export const useReply = ({
const { email: userEmail } = useAuthStore();
const [content, setContent] = useState<string>("");
const [isExpanded, setIsExpanded] = useState<boolean>(false);
const [attachments, setAttachments] = useState<EmailAttachmentDto[]>([]);
const sendEmailMutation = useSendEmail();
const resetForm = () => {
setContent("");
setIsExpanded(false);
setAttachments([]);
};
const handleSendReply = async (html: string) => {
@@ -97,6 +99,7 @@ ${
originalMessage.html?.join("").replace(/<[^>]*>/g, "") ||
""
}`,
attachments: attachments.length > 0 ? attachments : undefined,
};
try {
@@ -144,8 +147,10 @@ ${
content,
isExpanded,
isSending: sendEmailMutation.isPending,
attachments,
setContent,
setAttachments,
expandReply,
collapseReply,
handleSendReply,