1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-14 09:20:06 +00:00

chore(web): remove baseUrl from axios requests

This commit is contained in:
2021-10-22 18:22:55 +00:00
parent 9db65c9fa9
commit 1d66079e11
2 changed files with 6 additions and 6 deletions

View File

@@ -19,16 +19,16 @@ const Main = (props: any) => {
const [editMode, setEditMode] = useState(false) const [editMode, setEditMode] = useState(false)
useEffect(() => { useEffect(() => {
if (props.selectedFilePath !== '') { if (props.selectedFilePath) {
setIsLoading(true) setIsLoading(true)
axios axios
.get(`${baseUrl}/SASjsApi/files?filePath=${props.selectedFilePath}`) .get(`/SASjsApi/files?filePath=${props.selectedFilePath}`)
.then((res: any) => { .then((res: any) => {
setIsLoading(false) setIsLoading(false)
setFileContent(res.data.fileContent) setFileContent(res.data.fileContent)
}) })
} }
}, [props.selectedFilePath, baseUrl]) }, [props.selectedFilePath])
const handleEditSaveBtnClick = () => { const handleEditSaveBtnClick = () => {
if (!editMode) { if (!editMode) {
@@ -37,7 +37,7 @@ const Main = (props: any) => {
} else { } else {
setIsLoading(true) setIsLoading(true)
axios axios
.post(`${baseUrl}/SASjsApi/files`, { .post(`/SASjsApi/files`, {
filePath: props.selectedFilePath, filePath: props.selectedFilePath,
fileContent: fileContent fileContent: fileContent
}) })

View File

@@ -44,14 +44,14 @@ const SideBar = (props: any) => {
const [directoryData, setDirectoryData] = useState<TreeNode | null>(null) const [directoryData, setDirectoryData] = useState<TreeNode | null>(null)
useEffect(() => { useEffect(() => {
axios.get(`${baseUrl}/SASjsApi/executor`).then((res: any) => { axios.get(`/SASjsApi/executor`).then((res: any) => {
if (res.data && res.data?.status === 'success') { if (res.data && res.data?.status === 'success') {
setDirectoryData(res.data.tree) setDirectoryData(res.data.tree)
} }
}) })
const queryParams = new URLSearchParams(location.search) const queryParams = new URLSearchParams(location.search)
props.setSelectedFilePath(queryParams.get('filePath')) props.setSelectedFilePath(queryParams.get('filePath'))
}, [baseUrl, location.search, props]) }, [location.search, props])
const handleSelect = (node: TreeNode) => { const handleSelect = (node: TreeNode) => {
if (!node.children.length) { if (!node.children.length) {