mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 16:00:28 +01:00
CORS SUCCESS!!!
This commit is contained in:
parent
54142b73fb
commit
a650e628e5
@ -15,26 +15,28 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handshake(){
|
handshake(){
|
||||||
this.startTime = undefined;
|
if (this.server.host && this.server.apiKey){
|
||||||
this.endTime = undefined;
|
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() {
|
mounted() {
|
||||||
this.handshake()
|
this.handshake()
|
||||||
},
|
},
|
||||||
@ -57,18 +59,21 @@ export default {
|
|||||||
<div class="d-flex gap-3 align-items-center flex-grow-1">
|
<div class="d-flex gap-3 align-items-center flex-grow-1">
|
||||||
<i class="bi bi-server"></i>
|
<i class="bi bi-server"></i>
|
||||||
<input class="form-control form-control-sm"
|
<input class="form-control form-control-sm"
|
||||||
|
@blur="this.handshake()"
|
||||||
v-model="this.server.host"
|
v-model="this.server.host"
|
||||||
type="url">
|
type="url">
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-3 align-items-center flex-grow-1">
|
<div class="d-flex gap-3 align-items-center flex-grow-1">
|
||||||
<i class="bi bi-key-fill"></i>
|
<i class="bi bi-key-fill"></i>
|
||||||
<input class="form-control form-control-sm"
|
<input class="form-control form-control-sm"
|
||||||
|
@blur="this.handshake()"
|
||||||
v-model="this.server.apiKey"
|
v-model="this.server.apiKey"
|
||||||
type="text">
|
type="text">
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
<button
|
<button
|
||||||
@click="this.$emit('delete')"
|
@click="this.$emit('delete')"
|
||||||
|
|
||||||
class="ms-auto btn btn-sm bg-danger-subtle text-danger-emphasis border-1 border-danger-subtle">
|
class="ms-auto btn btn-sm bg-danger-subtle text-danger-emphasis border-1 border-danger-subtle">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user