|
|
@@ -59,30 +59,18 @@ function createMainWindow() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
async function sendAPIRequest(data = {}) { |
|
|
|
try { |
|
|
|
const response = await fetch(endpoint, { |
|
|
|
method: 'POST', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json', |
|
|
|
}, |
|
|
|
body: JSON.stringify(data), |
|
|
|
}); |
|
|
|
|
|
|
|
const textResponse = await response.text(); |
|
|
|
try { |
|
|
|
const result = JSON.parse(textResponse.toString()); |
|
|
|
if (!response.ok) { |
|
|
|
console.error(`API call failed with is_online: ${response.is_online}`, result); |
|
|
|
} else { |
|
|
|
console.log('API call succeeded:', result.toString()); |
|
|
|
} |
|
|
|
} catch (jsonError) { |
|
|
|
console.error('Error parsing JSON response:', textResponse.toString()); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('Error during API call:', error.toString()); |
|
|
|
} |
|
|
|
function sendAPIRequest(data = {}) { |
|
|
|
fetch(endpoint, { |
|
|
|
method: 'POST', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json', |
|
|
|
}, |
|
|
|
body: JSON.stringify(data), |
|
|
|
}).then(function (response) { |
|
|
|
console.log("Pass: ", response); |
|
|
|
}, function (error) { |
|
|
|
console.log("Error: ", error) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getMacAddress() { |
|
|
|