Skip to content

Commit

Permalink
fix: fixed folder update in front end
Browse files Browse the repository at this point in the history
  • Loading branch information
Molaryy committed Aug 31, 2023
1 parent 46b1b29 commit 6c715fc
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/components/folder/UploadFolder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const UploadFolder = (): JSX.Element => {
if (!upload.success || !upload.file)
toast({title: upload.message, status: upload.success ? 'success' : 'error'});
else {
setFiles([...files, upload.file]);
user.drive.files.push(upload.file);

await user.fullContact.files.addToContact(user.account.address, upload.file);
Expand All @@ -148,17 +149,11 @@ const UploadFolder = (): JSX.Element => {
await getAllFolders(folderTree.folders);
const createdFolder = await user.fullContact.folders.uploadFolders(allIpcFolders);
await getAllFiles(folderTree.files, folderEvent.target.files);
Array.prototype.forEach.call(allIpcFolders, (f) => {
setFolders([...folders, f]);
console.log(folders);
console.log(f);
})
setFolders([...folders, ...allIpcFolders])
toast({title: createdFolder.message, status: createdFolder.success ? 'success' : 'error'});
} else {
toast({title: 'Failed to load account', status: 'error'});
}


onClose();
setFolderEvent(undefined);
setIsLoading(false);
Expand Down

0 comments on commit 6c715fc

Please sign in to comment.