-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_4.js
41 lines (36 loc) · 1.3 KB
/
script_4.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
40
41
function start() {
let token = document.getElementById("a").value;
let type = document.getElementById("b").value;
let txt = document.getElementById("c").value;
fetch('https://statman.darkmash.repl.co/service/lt/' + type , {
method: "GET",
headers: {
"token": token,
"text" : txt,
},
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));
}