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 [openFileId, setOpenFileId] = useState<ObjID>()
|
||||||
const [showFile, setShowFile] = useState(false)
|
const [showFile, setShowFile] = useState(false)
|
||||||
|
|
||||||
const [srcID,setSrcID] = useState<ObjID>(path)
|
const [srcID,setSrcID] = useState<ObjID | null>()
|
||||||
const [pasteAction,setPasteAction] = useState<Action>()
|
const [pasteAction,setPasteAction] = useState<Action>()
|
||||||
const [editID,setEditID] = useState<ObjID>(path)
|
const [editID,setEditID] = useState<ObjID>()
|
||||||
const [editEnable,setEditEnable] = useState(false)
|
const [editEnable,setEditEnable] = useState(false)
|
||||||
|
|
||||||
const [deleteMutation] = useDeleteFileMutation()
|
const [deleteMutation] = useDeleteFileMutation()
|
||||||
@ -70,14 +70,15 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
setPasteAction(action)
|
setPasteAction(action)
|
||||||
break
|
break
|
||||||
case Action.FilePaste:
|
case Action.FilePaste:
|
||||||
if (pasteAction === Action.FileCopy){
|
if (pasteAction === Action.FileCopy && srcID){
|
||||||
await copyMutation({variables:{src:srcID,dest:path}})
|
await copyMutation({variables:{src:srcID,dest:path}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pasteAction === Action.FileMove){
|
if (pasteAction === Action.FileMove && srcID){
|
||||||
await moveMutation({variables:{src:srcID,dest:path}})
|
await moveMutation({variables:{src:srcID,dest:path}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
|
setSrcID(null)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case Action.DirDelete:
|
case Action.DirDelete:
|
||||||
|
Loading…
Reference in New Issue
Block a user