From 552a3584ec9345bc1dec0ff5377bf773a7928d62 Mon Sep 17 00:00:00 2001 From: sabhas Date: Mon, 25 Oct 2021 06:10:35 +0000 Subject: [PATCH] fix(weeb): add catch block with each axios request --- web/src/containers/Drive/main.tsx | 10 ++++++++-- web/src/containers/Drive/sideBar.tsx | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/src/containers/Drive/main.tsx b/web/src/containers/Drive/main.tsx index c45484d..a8da137 100644 --- a/web/src/containers/Drive/main.tsx +++ b/web/src/containers/Drive/main.tsx @@ -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) }) } } diff --git a/web/src/containers/Drive/sideBar.tsx b/web/src/containers/Drive/sideBar.tsx index 8cb8e95..cbf033f 100644 --- a/web/src/containers/Drive/sideBar.tsx +++ b/web/src/containers/Drive/sideBar.tsx @@ -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) {