Merge branch 'dev' into staging

This commit is contained in:
Max S 2024-09-12 12:14:46 +02:00
commit 4b165045a8

View File

@ -29,6 +29,7 @@ export default function SendDocuments() {
const [clientSelection, setClientSelection] = useState<EClientSelection | null>(null);
const [selectedClients, setSelectedClients] = useState<string[]>([]);
const [files, setFiles] = useState<File[]>([]);
const [isSending, setIsSending] = useState(false);
const onFormSubmit = useCallback(
async (
@ -43,6 +44,7 @@ export default function SendDocuments() {
}
try {
setIsSending(true);
await Promise.all(
selectedClients.map(async (customer) => {
const promises = files.map(async (file) => {
@ -65,8 +67,10 @@ export default function SendDocuments() {
.get()
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folderUid as string),
);
setIsSending(false);
console.log("All files have been successfully sent.");
} catch (error) {
setIsSending(false);
console.error("Error while sending files: ", error);
}
},
@ -179,7 +183,7 @@ export default function SendDocuments() {
Annuler
</Button>
</a>
<Button type="submit" rightIcon={<PaperAirplaneIcon />}>
<Button type="submit" rightIcon={<PaperAirplaneIcon />} isLoading={isSending}>
Envoyer
</Button>
</div>