mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: hook up the request to the send mail form
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { useFormikContext } from 'formik';
|
||||
import { chain } from 'lodash';
|
||||
import { InvoiceSendMailFormValues } from './_types';
|
||||
|
||||
export const useInvoiceMailItems = () => {
|
||||
const { values } = useFormikContext<InvoiceSendMailFormValues>();
|
||||
const cc = values?.cc || [];
|
||||
const bcc = values?.bcc || [];
|
||||
|
||||
return chain([...values?.to, ...cc, ...bcc])
|
||||
.filter((email) => !!email?.trim())
|
||||
.uniq()
|
||||
.map((email) => ({
|
||||
value: email,
|
||||
text: email,
|
||||
}))
|
||||
.value();
|
||||
};
|
||||
Reference in New Issue
Block a user