mirror of
https://github.com/sasjs/server.git
synced 2026-01-13 09:00:04 +00:00
fix: load file when url contains filePath
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
|
|
||||||
import { makeStyles } from '@mui/styles'
|
import { makeStyles } from '@mui/styles'
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ const useStyles = makeStyles(() => ({
|
|||||||
const drawerWidth = 240
|
const drawerWidth = 240
|
||||||
|
|
||||||
const SideBar = (props: any) => {
|
const SideBar = (props: any) => {
|
||||||
|
const location = useLocation()
|
||||||
const baseUrl = window.location.origin
|
const baseUrl = window.location.origin
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
@@ -47,6 +49,8 @@ const SideBar = (props: any) => {
|
|||||||
setDirectoryData(res.data.tree)
|
setDirectoryData(res.data.tree)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const queryParams = new URLSearchParams(location.search)
|
||||||
|
props.setSelectedFilePath(queryParams.get('filePath'))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const handleSelect = (node: TreeNode) => {
|
const handleSelect = (node: TreeNode) => {
|
||||||
@@ -54,7 +58,7 @@ const SideBar = (props: any) => {
|
|||||||
window.history.pushState(
|
window.history.pushState(
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
`${baseUrl}/#/SASjsDrive?filepath=${node.relativePath}`
|
`${baseUrl}/#/SASjsDrive?filePath=${node.relativePath}`
|
||||||
)
|
)
|
||||||
props.setSelectedFilePath(node.relativePath)
|
props.setSelectedFilePath(node.relativePath)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user