-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_3.js
39 lines (34 loc) · 1.2 KB
/
script_3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function start() {
let token = document.getElementById("a").value;
let txt = document.getElementById("b").value;
fetch('https://statman.darkmash.repl.co/service/l/' + txt, {
method: "GET",
headers: {
"token": token,
},
mode: 'cors',
}).then(response => response.text())
.then((response) => {
console.log(response);
if (response == "RUNNING") {
location.href = "error_already_running.html";
} else if (response == "Invalid Token") {
location.href = "error_invalid_token.html";
}
}).catch(err => console.log(err));
}
function stop_() {
let token = document.getElementById("a").value;
fetch('https://statman.darkmash.repl.co/service/stop', {
method: "GET",
headers: { "token": token },
mode: 'cors'
}).then(response => response.text())
.then((response) => {
if (response == "Notfound") {
location.href = "error_nothing_to_stop.html";
} else {
location.href = "index.html";
}
}).catch(err => console.log(err));
}