Skip to content

Commit

Permalink
fix: repetitive confirm dialog when permanently deleting multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlimjustin committed Nov 29, 2021
1 parent 73a856a commit 943f56d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Components/Files/File Operation/trash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ const RestoreFile = async (original_parent: string, basename: string): Promise<v
* @returns {void}
*/
const PermanentDelete = async (filePaths: string[]): Promise<void> => {
const confirm = await ConfirmDialog(
'Permanently delete file',
filePaths.length > 1
? "Are you sure to permanently delete these files/dirs? This can't be undone."
: "Are you sure to permanently delete this file/dir? This can't be undone.",
'Yes'
);
if (!confirm) return;
for (const filePath of filePaths) {
const confirm = await ConfirmDialog(
'Permanently delete file',
"Are you sure to permanently delete this file/dir? This can't be undone.",
'Yes'
);
if (!confirm) return;
await new OperationAPI(filePath).unlink();
}
};
Expand Down

1 comment on commit 943f56d

@vercel
Copy link

@vercel vercel bot commented on 943f56d Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.