Incepere creare procese separate

This commit is contained in:
andrei-mihnea-cerbu
2024-04-03 23:22:38 +03:00
parent 038b809dd8
commit ffeebf1177
58 changed files with 913 additions and 479 deletions
+33
View File
@@ -0,0 +1,33 @@
document.addEventListener('DOMContentLoaded', async function () {
const submitButton = document.getElementById('submit');
const ipInput = document.getElementById('ipInput');
submitButton.addEventListener('click', async function (e) {
e.preventDefault();
try {
const ipAddress = ipInput.value.trim();
if (!ipAddress) {
throw new Error('Please enter an IP address.');
}
fetch(`http://${ipAddress}/heartbeat`)
.then(async response => {
if (!response.ok) {
throw new Error('Test failed. Check ip and server.');
}
await window.electronAPI.writeFile('ipConfig.json', JSON.stringify({ip: ipAddress}));
fadeOut('login.html');
})
.catch(error => {
console.error('Error:', error.message);
throw new Error(error.message);
});
} catch (error) {
console.error('Error:', error.message);
await window.electronAPI.showAlert(error.message)
.then(() => console.log('Alert window opened'))
.catch(error => console.error('Error showing alert:', error));
}
});
});