Funciona
This commit is contained in:
@@ -62,6 +62,23 @@ app.whenReady().then(() => {
|
|||||||
// HANDLE es bidireccionar ON es unidireccional
|
// HANDLE es bidireccionar ON es unidireccional
|
||||||
ipcMain.handle("nfc:labelReq", async (_event, data: unknown) => {
|
ipcMain.handle("nfc:labelReq", async (_event, data: unknown) => {
|
||||||
console.log("nfc:labelReq", data);
|
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;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -89,13 +89,7 @@ const readCard = async (): void => {
|
|||||||
const override = false;
|
const override = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.api.nfc.labelReq({card_id,override});
|
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";
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
readerState.value = "error";
|
readerState.value = "error";
|
||||||
|
|||||||
Reference in New Issue
Block a user