add attachment in reply
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user