Version 8.0.0.
This commit is contained in:
@ -109,21 +109,25 @@ export class Status {
|
||||
|
||||
private async checkStatus() {
|
||||
if (this._enabled) {
|
||||
var response = await axios.get<ZcStatus>('http://cpatapi.cpsrvweb2016.cp-austria.at/availability/' + encodeURIComponent(this._user));
|
||||
try {
|
||||
var response = await axios.get<ZcStatus>('http://cpatapi.cpsrvweb2016.cp-austria.at/availability/' + encodeURIComponent(this._user));
|
||||
|
||||
if (response.status == 200) {
|
||||
var status = response.data;
|
||||
if (this._currentStatus !== status.loggedIn) {
|
||||
this._currentStatus = status.loggedIn;
|
||||
console.log('New status, loggedIn', this._currentStatus);
|
||||
(document.getElementsByClassName("current-status")[0] as HTMLAnchorElement).click();
|
||||
setTimeout(() => {
|
||||
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
||||
(document.getElementById(statusId) as HTMLAnchorElement).click();
|
||||
}, 1000);
|
||||
if (response.status == 200) {
|
||||
var status = response.data;
|
||||
if (this._currentStatus !== status.loggedIn) {
|
||||
this._currentStatus = status.loggedIn;
|
||||
console.log('New status, loggedIn', this._currentStatus);
|
||||
(document.getElementsByClassName("current-status")[0] as HTMLAnchorElement).click();
|
||||
setTimeout(() => {
|
||||
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
||||
(document.getElementById(statusId) as HTMLAnchorElement).click();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => this.checkStatus(), 10000);
|
||||
setTimeout(() => this.checkStatus(), 30000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user