This commit is contained in:
2026-03-11 17:48:44 +01:00
parent 19ff0cbc9a
commit f85c0e3b08
2 changed files with 18 additions and 7 deletions

View File

@@ -62,6 +62,23 @@ app.whenReady().then(() => {
// HANDLE es bidireccionar ON es unidireccional
ipcMain.handle("nfc:labelReq", async (_event, data: unknown) => {
console.log("nfc:labelReq", data);
try {
const response = await fetch("http://localhost:3000/nfc/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
card_id: "019cdd39-fc08-7417-b16d-a78794a24c01",
override: false,
}),
});
console.log("Codigos:", response);
return 200;
} catch (error) {
console.error(error);
return false;
}
return data;
});

View File

@@ -89,13 +89,7 @@ const readCard = async (): void => {
const override = false;
try {
window.api.nfc.labelReq({card_id,override});
const response = await axios.post<CodeResponse>(serverURL + endpoint, {
card_id,
override,
});
console.log("Resp", response);
readerState.value = "waiting";
window.api.nfc.labelReq({ card_id, override });
} catch (e) {
console.error(e);
readerState.value = "error";