PC 켜기 응답 처리 정리
This commit is contained in:
+11
-1
@@ -345,9 +345,19 @@ async function wakeComputer() {
|
||||
return;
|
||||
}
|
||||
|
||||
await fetch('/custom/wakeonlan/api.php', { method: 'POST', credentials: 'same-origin' })
|
||||
const sent = await fetch('/custom/wakeonlan/api.php', { method: 'POST', credentials: 'same-origin' })
|
||||
.then(res => res.ok ? res.json() : Promise.reject());
|
||||
|
||||
if (sent && sent.result === 'already') {
|
||||
launcherAlert('wakeonlan_already');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sent || sent.result !== 'sent') {
|
||||
launcherAlert('error');
|
||||
return;
|
||||
}
|
||||
|
||||
launcherAlert('wakeonlan_request_sent');
|
||||
|
||||
let attempts = 0;
|
||||
|
||||
Reference in New Issue
Block a user