@intuitionrobotics/bug-report
Version:
39 lines • 1.57 kB
JavaScript
import { Module } from "@intuitionrobotics/ts-common";
import { XhrHttpModule } from "@intuitionrobotics/thunderstorm/frontend";
import { HttpMethod } from "@intuitionrobotics/thunderstorm";
import {} from "../../shared/api.js";
export const RequestKey_GetLog = "GetLog";
export const RequestKey_PostPath = "PostPath";
export class AdminBRModule_Class extends Module {
constructor() {
super("AdminBRModule");
}
logs = [];
retrieveLogs = () => {
this.logInfo("getting logs from firestore...");
XhrHttpModule
.createRequest(HttpMethod.GET, RequestKey_GetLog)
.setRelativeUrl("/v1/bug-reports/get-logs")
.setOnError(`Error getting new message from backend`)
.execute(async (response) => {
this.logs = response;
});
this.logInfo("continue... will receive an event once request is completed..");
};
downloadLogs = (path) => {
this.logInfo("downloading the logs to the client..");
const bodyObject = { path: path };
XhrHttpModule
.createRequest(HttpMethod.POST, RequestKey_PostPath)
.setJsonBody(bodyObject)
.setRelativeUrl("/v1/bug-reports/download-logs")
.setOnError(`Error getting new message from backend`)
.execute();
};
downloadMultiLogs = (reports) => {
reports.forEach(report => this.downloadLogs(report.path));
};
getLogs = () => this.logs;
}
export const AdminBRModule = new AdminBRModule_Class();
//# sourceMappingURL=AdminBRModule.js.map