fixed parsing for uptime
This commit is contained in:
@@ -1212,7 +1212,15 @@
|
||||
fetch("/cgi-bin/get_uptime")
|
||||
.then((response) => response.text())
|
||||
.then((data) => {
|
||||
this.uptime = data;
|
||||
// Split the data by space
|
||||
const uptimeArray = data.split(" ");
|
||||
console.log(uptimeArray);
|
||||
// If uptimeArray[3] is not empty, then set the uptime for days
|
||||
if (uptimeArray[3] !== "") {
|
||||
this.uptime = uptimeArray[3] + " days, " + uptimeArray[5].split(":")[0] + " hours, and " + uptimeArray[5].split(":")[1].replace(",", "") + " minutes";
|
||||
} else {
|
||||
this.uptime = uptimeArray[4].split(":")[0] + " hours and " + uptimeArray[4].split(":")[1].replace(",", "") + " minutes";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user