program finalizat

This commit is contained in:
andrei-mihnea-cerbu
2024-10-29 15:07:26 +02:00
parent ab1eaec413
commit 979539d3db
138 changed files with 14602 additions and 5068 deletions
+31
View File
@@ -0,0 +1,31 @@
document.addEventListener('DOMContentLoaded', async function () {
const operationCodes = await window.electronAPI.getOperationsCodes();
if (!operationCodes) {
await window.electronAPI.showAlert('Internal error of the application. Failed to retrieve operation codes.');
return;
}
const codeResetDatabase = operationCodes.RESET_DATABASE;
const codeOk = operationCodes.OK;
// Open a TCP socket to the stored IP
if (!await window.electronAPI.openUcSocket()) {
await window.electronAPI.showAlert('Internal error of the application. Unable to open socket.');
return;
}
if (!await window.electronAPI.sendUcMessage(codeResetDatabase)) {
await window.electronAPI.showAlert('Failed to send login request.');
return;
}
const response = await waitForResponse();
if (response && response.operationCode !== codeOk) {
await window.electronAPI.showAlert('Database reset failed.');
return;
}
await window.electronAPI.closeUcSocket();
await new Promise(resolve => setTimeout(resolve, 2000));
fadeOut('login');
});