✨ add loader when sending documents
This commit is contained in:
parent
58500e5266
commit
71873a9001
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user