diff --git a/client/src/utils.js b/client/src/utils.js index 3316387..be7afb5 100644 --- a/client/src/utils.js +++ b/client/src/utils.js @@ -15,7 +15,7 @@ export async function sendCommand(command, value) { const endpoint = getEndpoint() const url = new URL(`/get?command=${command}&value=${value}`, endpoint) const response = await fetch(url, { - mode: 'no-cors' + mode: 'no-cors', }) const text = await response.text() console.log(text) @@ -58,9 +58,9 @@ export async function testEndpoint(endpoint) { try { const url = new URL('/get', endpoint) const response = await fetch(url, { - mode: 'no-cors' + mode: 'no-cors', }) - if (response.ok) return + if (response.ok || response.status === 0) alert('Connection réussie') } catch (cause) { alert(`Impossible de joindre l'adresse "${endpoint}"`) throw new Error(`unable to connect to robot at ${endpoint}`, {