diff --git a/web/src/containers/Drive/main.tsx b/web/src/containers/Drive/main.tsx index 7fbf7309..fa083a4d 100644 --- a/web/src/containers/Drive/main.tsx +++ b/web/src/containers/Drive/main.tsx @@ -23,7 +23,7 @@ const Main = (props: any) => { if (props.selectedFilePath) { setIsLoading(true) axios - .get(`/SASjsApi/drive/file?filePath=${props.selectedFilePath}`) + .get(`/SASjsApi/drive/file?_filePath=${props.selectedFilePath}`) .then((res: any) => { setFileContent(res.data) }) @@ -36,6 +36,25 @@ const Main = (props: any) => { } }, [props.selectedFilePath]) + const handleDeleteBtnClick = () => { + setIsLoading(true) + + const filePath = props.selectedFilePath + + axios + .delete(`/SASjsApi/drive/file?_filePath=${filePath}`) + .then((res) => { + setFileContent('') + window.history.pushState('', '', `${baseUrl}/#/SASjsDrive`) + }) + .catch((err) => { + console.log(err) + }) + .finally(() => { + setIsLoading(false) + }) + } + const handleEditSaveBtnClick = () => { if (!editMode) { setFileContentBeforeEdit(fileContent) @@ -112,6 +131,13 @@ const Main = (props: any) => { direction="row" sx={{ justifyContent: 'center', marginTop: '20px' }} > +