diff --git a/src/static/app/src/components/signInComponents/RemoteServer.vue b/src/static/app/src/components/signInComponents/RemoteServer.vue index 659e675..f2d9e28 100644 --- a/src/static/app/src/components/signInComponents/RemoteServer.vue +++ b/src/static/app/src/components/signInComponents/RemoteServer.vue @@ -15,28 +15,30 @@ export default { }, methods: { handshake(){ - this.startTime = undefined; - this.endTime = undefined; + if (this.server.host && this.server.apiKey){ + this.startTime = undefined; + this.endTime = undefined; + this.startTime = dayjs() + fetch(`${this.server.host}/api/handshake`, { + headers: { + "content-type": "application/json", + "wg-dashboard-apikey": this.server.apiKey + }, + method: "GET", + signal: AbortSignal.timeout(5000) + }).then(res => res.json()).then(res => { + this.active = true; + this.endTime = dayjs() + }).catch((res) => { + this.startTime = undefined; + this.endTime = undefined; + }) + } - this.startTime = dayjs() - fetch(`//${this.server.host}/api/handshake`, { - headers: { - "content-type": "application/json", - "wg-dashboard-apikey": this.server.apiKey - }, - method: "GET", - signal: AbortSignal.timeout(5000) - }).then(res => res.json()).then(res => { - this.active = true; - this.endTime = dayjs() - }).catch((res) => { - console.log(res) - }) } }, - mounted() { - this.handshake() + this.handshake() }, computed: { getHandshakeTime(){ @@ -56,19 +58,22 @@ export default {
-
-