1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

fix(weeb): add catch block with each axios request

This commit is contained in:
2021-10-25 06:10:35 +00:00
parent 03d1d60660
commit 552a3584ec
2 changed files with 11 additions and 3 deletions

View File

@@ -24,8 +24,11 @@ const Main = (props: any) => {
axios
.get(`/SASjsApi/files?filePath=${props.selectedFilePath}`)
.then((res: any) => {
setIsLoading(false)
setFileContent(res.data.fileContent)
}).catch((err) => {
console.log(err)
}).finally(() => {
setIsLoading(false)
})
}
}, [props.selectedFilePath])
@@ -42,8 +45,11 @@ const Main = (props: any) => {
fileContent: fileContent
})
.then((res) => {
setIsLoading(false)
setEditMode(false)
}).catch((err) => {
console.log(err)
}).finally(() => {
setIsLoading(false)
})
}
}

View File

@@ -48,10 +48,12 @@ const SideBar = (props: any) => {
if (res.data && res.data?.status === 'success') {
setDirectoryData(res.data.tree)
}
}).catch((err) => {
console.log(err)
})
const queryParams = new URLSearchParams(location.search)
props.setSelectedFilePath(queryParams.get('filePath'))
}, [location.search, props])
}, [])
const handleSelect = (node: TreeNode) => {
if (!node.children.length) {