Merged CEO and Client App

This commit is contained in:
andrei-mihnea-cerbu
2025-02-06 10:25:13 +02:00
parent eda2e2d2a0
commit 23802acd98
186 changed files with 365 additions and 11234 deletions
@@ -0,0 +1,31 @@
document.addEventListener('DOMContentLoaded', async function () {
const operationCodes = await window.networkAPI.getOperationsCodes();
if (!operationCodes) {
await window.uiAPI.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.networkAPI.openUcSocket()) {
await window.uiAPI.showAlert('Internal error of the application. Unable to open socket.');
return;
}
if (!await window.networkAPI.sendUcMessage(codeResetDatabase)) {
await window.uiAPI.showAlert('Failed to send login request.');
return;
}
const response = await waitForResponse();
if (response && response.operationCode !== codeOk) {
await window.uiAPI.showAlert('Database reset failed.');
return;
}
await window.networkAPI.closeUcSocket();
await new Promise(resolve => setTimeout(resolve, 2000));
fadeOut('login');
});