@nu-art/bug-report
Version:
64 lines (63 loc) • 2.85 kB
JavaScript
;
/*
* Allow the user to file a bug report directly from your app
*
* Copyright (C) 2020 Adam van der Kruk aka TacB0sS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModuleFE_BugReportAdmin = exports.ModuleFE_BugReportAdmin_Class = exports.RequestKey_PostPath = exports.RequestKey_GetLog = void 0;
const ts_common_1 = require("@nu-art/ts-common");
const frontend_1 = require("@nu-art/thunderstorm/frontend");
const api_1 = require("../../shared/api");
exports.RequestKey_GetLog = 'GetLog';
exports.RequestKey_PostPath = 'PostPath';
class ModuleFE_BugReportAdmin_Class extends ts_common_1.Module {
constructor() {
super();
this.logs = [];
// public retrieveLogs = () => {
// this.logInfo('getting logs from firestore...');
// ModuleFE_XHR
// .createRequest<ApiGetLog>(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..');
// };
// public downloadLogs = (path: string) => {
// this.logInfo('downloading the logs to the client..');
// const bodyObject: Paths = {path: path};
// ModuleFE_XHR
// .createRequest<ApiPostPath>(HttpMethod.POST, RequestKey_PostPath)
// .setBodyAsJson(bodyObject)
// .setRelativeUrl('v1/bug-reports/download-logs')
// .setOnError(`Error getting new message from backend`)
// .execute();
// };
this.downloadMultiLogs = (reports) => {
reports.forEach(report => this.v1.downloadLogs({ path: report.path }).execute());
};
this.getLogs = () => this.logs;
this.v1 = {
downloadLogs: (0, frontend_1.apiWithBody)(api_1.ApiDef_AdminBugReport.v1.downloadLogs),
retrieveLogs: (0, frontend_1.apiWithQuery)(api_1.ApiDef_AdminBugReport.v1.retrieveLogs),
};
}
}
exports.ModuleFE_BugReportAdmin_Class = ModuleFE_BugReportAdmin_Class;
exports.ModuleFE_BugReportAdmin = new ModuleFE_BugReportAdmin_Class();