fixed srcID on context menu action
This commit is contained in:
parent
9664eb07b8
commit
c12181fe16
@ -22,9 +22,9 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
||||
const [openFileId, setOpenFileId] = useState<ObjID>()
|
||||
const [showFile, setShowFile] = useState(false)
|
||||
|
||||
const [srcID,setSrcID] = useState<ObjID>(path)
|
||||
const [srcID,setSrcID] = useState<ObjID | null>()
|
||||
const [pasteAction,setPasteAction] = useState<Action>()
|
||||
const [editID,setEditID] = useState<ObjID>(path)
|
||||
const [editID,setEditID] = useState<ObjID>()
|
||||
const [editEnable,setEditEnable] = useState(false)
|
||||
|
||||
const [deleteMutation] = useDeleteFileMutation()
|
||||
@ -70,14 +70,15 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
||||
setPasteAction(action)
|
||||
break
|
||||
case Action.FilePaste:
|
||||
if (pasteAction === Action.FileCopy){
|
||||
if (pasteAction === Action.FileCopy && srcID){
|
||||
await copyMutation({variables:{src:srcID,dest:path}})
|
||||
refetchDir()
|
||||
}
|
||||
|
||||
if (pasteAction === Action.FileMove){
|
||||
if (pasteAction === Action.FileMove && srcID){
|
||||
await moveMutation({variables:{src:srcID,dest:path}})
|
||||
refetchDir()
|
||||
setSrcID(null)
|
||||
}
|
||||
break
|
||||
case Action.DirDelete:
|
||||
|
Loading…
Reference in New Issue
Block a user