fix return type of writeRemoteFile, small formatting/fixes

This commit is contained in:
sawka 2023-09-01 20:15:48 -07:00
parent b5e9e34c52
commit 238c8fb250
3 changed files with 18 additions and 10 deletions

View File

@ -3655,7 +3655,13 @@ class Model {
return prtn;
}
writeRemoteFile(screenId: string, lineId: string, path: string, data: Uint8Array, opts?: { useTemp?: boolean }) {
writeRemoteFile(
screenId: string,
lineId: string,
path: string,
data: Uint8Array,
opts?: { useTemp?: boolean }
): Promise<void> {
opts = opts || {};
let params = {
screenid: screenId,
@ -3670,7 +3676,11 @@ class Model {
let url = new URL(GlobalModel.getBaseHostPort() + "/api/write-file");
let fetchHeaders = this.getFetchHeaders();
let prtn = fetch(url, { method: "post", headers: fetchHeaders, body: formData });
return prtn;
return prtn
.then((resp) => handleJsonFetchResponse(url, resp))
.then((data) => {
return;
});
}
}

View File

@ -23,6 +23,7 @@ import type {
import { PacketDataBuffer } from "./ptydata";
import { debounce, throttle } from "throttle-debounce";
import * as util from "./util";
import { GlobalModel } from "./model";
type OV<V> = mobx.IObservableValue<V>;
type CV<V> = mobx.IComputedValue<V>;
@ -94,8 +95,7 @@ class SimpleBlobRendererModel {
})();
if (delayMs == 0) {
this.reload_noDelay();
}
else {
} else {
setTimeout(() => {
reload_noDelay();
}, delayMs);
@ -106,11 +106,9 @@ class SimpleBlobRendererModel {
let source = this.lineState["prompt:source"] || "pty";
if (source == "pty") {
this.reloadPtyData();
}
else if (source == "file") {
} else if (source == "file") {
this.reloadFileData();
}
else {
} else {
mobx.action(() => {
this.loadError.set("error: invalid load source: " + source);
})();

View File

@ -393,7 +393,7 @@ type RendererModelInitializeParams = {
rawCmd: WebCmd;
savedHeight: number;
opts: RendererOpts;
lineState: LineStateType,
lineState: LineStateType;
api: RendererModelContainerApi;
ptyDataSource: (termContext: TermContextUnion) => Promise<PtyDataType>;
};
@ -410,7 +410,7 @@ type RendererModel = {
};
type SimpleBlobRendererComponent = React.ComponentType<{
path: String;
path: string;
data: Blob;
context: RendererContext;
opts: RendererOpts;