@electerm/electerm-react 3.15.41 → 3.15.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -871,11 +871,9 @@ export default class FileSection extends React.Component {
|
|
|
871
871
|
const { path, name, isDirectory } = this.state.file
|
|
872
872
|
const p = resolve(path, name)
|
|
873
873
|
const url = '/api/download?path=' + encodeURIComponent(p)
|
|
874
|
-
const res = await window.fetch(url
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
878
|
-
})
|
|
874
|
+
const res = await window.api.fetch(url)
|
|
875
|
+
.catch(window.store.onError)
|
|
876
|
+
if (!res) return
|
|
879
877
|
const blob = await res.blob()
|
|
880
878
|
const a = document.createElement('a')
|
|
881
879
|
a.href = URL.createObjectURL(blob)
|
|
@@ -983,13 +983,10 @@ export default class Sftp extends Component {
|
|
|
983
983
|
const formData = new FormData()
|
|
984
984
|
formData.append('file', file)
|
|
985
985
|
formData.append('path', localPath)
|
|
986
|
-
await window.fetch('/api/upload', {
|
|
986
|
+
await window.api.fetch('/api/upload', {
|
|
987
987
|
method: 'POST',
|
|
988
|
-
body: formData
|
|
989
|
-
|
|
990
|
-
token: window.store?.config.tokenElecterm
|
|
991
|
-
}
|
|
992
|
-
})
|
|
988
|
+
body: formData
|
|
989
|
+
}).catch(handleErr)
|
|
993
990
|
}
|
|
994
991
|
this.localList()
|
|
995
992
|
}
|