1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-14 17:30:05 +00:00

chore: code fixes

This commit is contained in:
2022-07-21 23:03:40 +05:00
parent 72140d73c2
commit 03cb89d14f
3 changed files with 11 additions and 12 deletions

View File

@@ -395,7 +395,7 @@ const deleteFolder = async (folderPath: string) => {
throw new Error('Cannot delete file outside drive.') throw new Error('Cannot delete file outside drive.')
} }
if (!(await fileExists(folderPathFull))) { if (!(await folderExists(folderPathFull))) {
throw new Error('Folder does not exist.') throw new Error('Folder does not exist.')
} }
@@ -482,7 +482,7 @@ const rename = async (
if (await fileExists(oldPathFull)) { if (await fileExists(oldPathFull)) {
if (await fileExists(newPathFull)) { if (await fileExists(newPathFull)) {
throw new Error('File already exists.') throw new Error('File already exists.')
} else moveFile(oldPath, newPathFull) } else moveFile(oldPathFull, newPathFull)
return { status: 'success' } return { status: 'success' }
} }

View File

@@ -9,6 +9,7 @@ const StaticAuthorizedRoutes = [
'/SASjsApi/drive/file', '/SASjsApi/drive/file',
'/SASjsApi/drive/folder', '/SASjsApi/drive/folder',
'/SASjsApi/drive/fileTree', '/SASjsApi/drive/fileTree',
'/SASjsApi/drive/rename',
'/SASjsApi/permission' '/SASjsApi/permission'
] ]

View File

@@ -221,19 +221,17 @@ const TreeViewNode = ({
: undefined : undefined
} }
> >
{node.isFolder && {node.isFolder && (
['Add Folder', 'Add File'].map((item) => ( <div>
<MenuItem onClick={handleNewFolderItemClick}>Add Folder</MenuItem>
<MenuItem <MenuItem
key={item} disabled={!node.relativePath}
onClick={() => onClick={handleNewFileItemClick}
item === 'Add Folder'
? handleNewFolderItemClick()
: handleNewFileItemClick()
}
> >
{item} Add File
</MenuItem> </MenuItem>
))} </div>
)}
<MenuItem disabled={!node.relativePath} onClick={handleRenameItemClick}> <MenuItem disabled={!node.relativePath} onClick={handleRenameItemClick}>
Rename Rename
</MenuItem> </MenuItem>