Package upgrades and cleanup.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import axios from "axios";
|
||||
import axios, { AxiosError } from "axios";
|
||||
import { BrowserWindow } from "electron";
|
||||
import log from "electron-log";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
@@ -6,6 +6,7 @@ import { promises as fsPromises } from "fs";
|
||||
import path from "path";
|
||||
import { RawJobDataObject } from "../decoder/decoder";
|
||||
import store from "../store/store";
|
||||
import ipcTypes from "../../util/ipcTypes.json";
|
||||
|
||||
// Function to write job object to logs subfolder
|
||||
async function writeJobToLogsFolder(job, fileName): Promise<string> {
|
||||
@@ -110,21 +111,21 @@ async function ScrubEstimate({
|
||||
pdfWindow.focus();
|
||||
return resultPDFUrl;
|
||||
} catch (error) {
|
||||
log.error("Error while scrubbing estimate:", error, error.stack);
|
||||
log.error("Error Response Data:", error.response?.data);
|
||||
const err = error as AxiosError;
|
||||
log.error("Error while scrubbing estimate:", error, err.stack);
|
||||
log.error("Error Response Data:", err.response?.data);
|
||||
const mainWindow = BrowserWindow.getAllWindows()[0];
|
||||
|
||||
if (error.status === 400) {
|
||||
mainWindow.webContents.send(ipcTypes.app.toRenderer.scrubError, {
|
||||
mainWindow.webContents.send(ipcTypes.toRenderer.scrub.scrubError, {
|
||||
message:
|
||||
error.response?.data ||
|
||||
"Error encountered sending estimate to Estimate Scrubber.",
|
||||
});
|
||||
} else if (error.status === 401) {
|
||||
mainWindow.webContents.send(ipcTypes.app.toRenderer.scrubError, {
|
||||
mainWindow.webContents.send(ipcTypes.toRenderer.scrub.scrubError, {
|
||||
message:
|
||||
"Authentication with Estimate Scrubber failed." ||
|
||||
error.response?.data,
|
||||
err.response?.data || "Authentication with Estimate Scrubber failed."ta,
|
||||
});
|
||||
}
|
||||
return "Error: Unable to scrub estimate.";
|
||||
|
||||
@@ -154,7 +154,7 @@ const Home: FC = () => {
|
||||
return (
|
||||
<div style={{ maxWidth: "1400px", margin: "0 auto" }}>
|
||||
<Space
|
||||
direction="vertical"
|
||||
orientation="vertical"
|
||||
size="large"
|
||||
style={{ width: "100%", display: "flex" }}
|
||||
>
|
||||
|
||||
@@ -60,7 +60,7 @@ const SettingsConfig: FC = () => {
|
||||
layout="vertical"
|
||||
size="large"
|
||||
>
|
||||
<Space direction="vertical" size="middle" style={{ width: "100%" }}>
|
||||
<Space orientation="vertical" size="middle" style={{ width: "100%" }}>
|
||||
{settingFields.map((field) => (
|
||||
<Form.Item
|
||||
key={field.name}
|
||||
|
||||
@@ -43,7 +43,7 @@ const UpdateAvailable: FC = () => {
|
||||
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
||||
}}
|
||||
>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Space orientation="vertical" style={{ width: "100%" }}>
|
||||
{updateProgress === 0 && (
|
||||
<Button onClick={handleDownload}>{t("updates.download")}</Button>
|
||||
)}
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
"error": "toRenderer_watcher_error",
|
||||
"polling": "toRenderer_watcher_polling"
|
||||
},
|
||||
"scrub": {
|
||||
"scrubError": "toRenderer_scrubError"
|
||||
},
|
||||
"updates": {
|
||||
"checking": "toRenderer_updates_checking",
|
||||
"available": "toRenderer_updates_available",
|
||||
|
||||
Reference in New Issue
Block a user