mirror of
https://github.com/sasjs/server.git
synced 2026-01-03 21:10:05 +00:00
fix(weeb): add catch block with each axios request
This commit is contained in:
@@ -24,8 +24,11 @@ const Main = (props: any) => {
|
|||||||
axios
|
axios
|
||||||
.get(`/SASjsApi/files?filePath=${props.selectedFilePath}`)
|
.get(`/SASjsApi/files?filePath=${props.selectedFilePath}`)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
setIsLoading(false)
|
|
||||||
setFileContent(res.data.fileContent)
|
setFileContent(res.data.fileContent)
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
}).finally(() => {
|
||||||
|
setIsLoading(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, [props.selectedFilePath])
|
}, [props.selectedFilePath])
|
||||||
@@ -42,8 +45,11 @@ const Main = (props: any) => {
|
|||||||
fileContent: fileContent
|
fileContent: fileContent
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setIsLoading(false)
|
|
||||||
setEditMode(false)
|
setEditMode(false)
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
}).finally(() => {
|
||||||
|
setIsLoading(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,12 @@ const SideBar = (props: any) => {
|
|||||||
if (res.data && res.data?.status === 'success') {
|
if (res.data && res.data?.status === 'success') {
|
||||||
setDirectoryData(res.data.tree)
|
setDirectoryData(res.data.tree)
|
||||||
}
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
})
|
})
|
||||||
const queryParams = new URLSearchParams(location.search)
|
const queryParams = new URLSearchParams(location.search)
|
||||||
props.setSelectedFilePath(queryParams.get('filePath'))
|
props.setSelectedFilePath(queryParams.get('filePath'))
|
||||||
}, [location.search, props])
|
}, [])
|
||||||
|
|
||||||
const handleSelect = (node: TreeNode) => {
|
const handleSelect = (node: TreeNode) => {
|
||||||
if (!node.children.length) {
|
if (!node.children.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user