1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 15:20:09 +01:00

CORS SUCCESS!!!

This commit is contained in:
Donald Zou 2024-08-10 19:23:50 -04:00
parent 54142b73fb
commit a650e628e5

View File

@ -15,11 +15,11 @@ export default {
},
methods: {
handshake(){
if (this.server.host && this.server.apiKey){
this.startTime = undefined;
this.endTime = undefined;
this.startTime = dayjs()
fetch(`//${this.server.host}/api/handshake`, {
fetch(`${this.server.host}/api/handshake`, {
headers: {
"content-type": "application/json",
"wg-dashboard-apikey": this.server.apiKey
@ -30,11 +30,13 @@ export default {
this.active = true;
this.endTime = dayjs()
}).catch((res) => {
console.log(res)
this.startTime = undefined;
this.endTime = undefined;
})
}
},
}
},
mounted() {
this.handshake()
},
@ -57,18 +59,21 @@ export default {
<div class="d-flex gap-3 align-items-center flex-grow-1">
<i class="bi bi-server"></i>
<input class="form-control form-control-sm"
@blur="this.handshake()"
v-model="this.server.host"
type="url">
</div>
<div class="d-flex gap-3 align-items-center flex-grow-1">
<i class="bi bi-key-fill"></i>
<input class="form-control form-control-sm"
@blur="this.handshake()"
v-model="this.server.apiKey"
type="text">
</div>
<div class="d-flex gap-2">
<button
@click="this.$emit('delete')"
class="ms-auto btn btn-sm bg-danger-subtle text-danger-emphasis border-1 border-danger-subtle">
<i class="bi bi-trash"></i>
</button>