fixed srcID on context menu action

This commit is contained in:
Djeeberjr 2021-09-29 22:28:27 +02:00
parent 9664eb07b8
commit c12181fe16

View File

@ -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: