Skip to content

Commit

Permalink
Merge pull request #1048 from fdm-monster/fix/better-coloring-test-co…
Browse files Browse the repository at this point in the history
…nnection-panel

fix: prevent string errors test connection, better color handling
  • Loading branch information
davidzwa authored Feb 20, 2024
2 parents 36cd405 + 11a9eed commit 3a1c2bc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/store/test-printer.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ export const useTestPrinterStore = defineStore("TestPrinter", {
return {
event,
payload: e.payload
?.toString()
?.replace("noResponse", "unreachable")
.replace("authFail", "authentication failure"),
failure: ["authFail", "noResponse", "aborted", "globalKey"].includes(e.payload),
failure: [
"authFail",
"noResponse",
"aborted",
"globalKey",
"error",
"connection error",
"closed",
"connection closed",
].includes(e.payload?.toString()),
};
});
},
Expand All @@ -51,8 +61,7 @@ export const useTestPrinterStore = defineStore("TestPrinter", {
},
async createTestPrinter(newPrinter: CreatePrinter) {
this.testPrinter = newPrinter;
const data = await PrintersService.testConnection(newPrinter);
return data;
return await PrintersService.testConnection(newPrinter);
},
saveEvent(event: TestEvent) {
this.testPrinterEvents?.push(event);
Expand Down

0 comments on commit 3a1c2bc

Please sign in to comment.