fix(ui): properly handle boolean json responses (#3626)
This commit is contained in:
@@ -441,7 +441,7 @@
|
|||||||
);
|
);
|
||||||
if (resp) {
|
if (resp) {
|
||||||
fetch("./api/apps/" + id, { method: "DELETE" }).then((r) => {
|
fetch("./api/apps/" + id, { method: "DELETE" }).then((r) => {
|
||||||
if (r.status == 200) document.location.reload();
|
if (r.status === 200) document.location.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -557,7 +557,7 @@
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(this.editForm),
|
body: JSON.stringify(this.editForm),
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.status == 200) document.location.reload();
|
if (r.status === 200) document.location.reload();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -94,10 +94,10 @@
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(this.passwordData),
|
body: JSON.stringify(this.passwordData),
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.status == 200) {
|
if (r.status === 200) {
|
||||||
r.json().then((rj) => {
|
r.json().then((rj) => {
|
||||||
if (rj.status.toString() === "true") {
|
this.success = rj.status;
|
||||||
this.success = true;
|
if (this.success === true) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
fetch("./api/pin", {method: "POST", body: b})
|
fetch("./api/pin", {method: "POST", body: b})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status.toString().toLowerCase() === "true") {
|
if (response.status === true) {
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
"#status"
|
"#status"
|
||||||
).innerHTML = `<div class="alert alert-success" role="alert">${this.i18n.t('pin.pair_success')}</div>`;
|
).innerHTML = `<div class="alert alert-success" role="alert">${this.i18n.t('pin.pair_success')}</div>`;
|
||||||
|
|||||||
@@ -120,7 +120,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul id="client-list" class="list-group list-group-flush list-group-item-light" v-if="clients && clients.length > 0">
|
<ul id="client-list" class="list-group list-group-flush list-group-item-light" v-if="clients && clients.length > 0">
|
||||||
<div v-for="client in clients" class="list-group-item d-flex">
|
<div v-for="client in clients" class="list-group-item d-flex">
|
||||||
<div class="p-2 flex-grow-1">{{client.name != "" ? client.name : $t('troubleshooting.unpair_single_unknown')}}</div><div class="me-2 ms-auto btn btn-danger" @click="unpairSingle(client.uuid)"><i class="fas fa-trash"></i></div>
|
<div class="p-2 flex-grow-1">{{ client.name !== "" ? client.name : $t('troubleshooting.unpair_single_unknown') }}</div>
|
||||||
|
<div class="me-2 ms-auto btn btn-danger" @click="unpairSingle(client.uuid)"><i class="fas fa-trash"></i></div>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
<ul v-else class="list-group list-group-flush list-group-item-light">
|
<ul v-else class="list-group list-group-flush list-group-item-light">
|
||||||
@@ -176,7 +177,7 @@
|
|||||||
actualLogs() {
|
actualLogs() {
|
||||||
if (!this.logFilter) return this.logs;
|
if (!this.logFilter) return this.logs;
|
||||||
let lines = this.logs.split("\n");
|
let lines = this.logs.split("\n");
|
||||||
lines = lines.filter(x => x.indexOf(this.logFilter) != -1);
|
lines = lines.filter(x => x.indexOf(this.logFilter) !== -1);
|
||||||
return lines.join("\n");
|
return lines.join("\n");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -210,7 +211,7 @@
|
|||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
this.closeAppPressed = false;
|
this.closeAppPressed = false;
|
||||||
this.closeAppStatus = r.status.toString() === "true";
|
this.closeAppStatus = r.status;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.closeAppStatus = null;
|
this.closeAppStatus = null;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@@ -222,7 +223,7 @@
|
|||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
this.unpairAllPressed = false;
|
this.unpairAllPressed = false;
|
||||||
this.unpairAllStatus = r.status.toString() === "true";
|
this.unpairAllStatus = r.status;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.unpairAllStatus = null;
|
this.unpairAllStatus = null;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
@@ -240,9 +241,9 @@
|
|||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const clientList = document.querySelector("#client-list");
|
const clientList = document.querySelector("#client-list");
|
||||||
if (response.status === 'true' && response.named_certs && response.named_certs.length) {
|
if (response.status === true && response.named_certs && response.named_certs.length) {
|
||||||
this.clients = response.named_certs.sort((a, b) => {
|
this.clients = response.named_certs.sort((a, b) => {
|
||||||
return (a.name.toLowerCase() > b.name.toLowerCase() || a.name == "" ? 1 : -1)
|
return (a.name.toLowerCase() > b.name.toLowerCase() || a.name === "" ? 1 : -1)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.clients = [];
|
this.clients = [];
|
||||||
@@ -270,7 +271,7 @@
|
|||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
this.ddResetPressed = false;
|
this.ddResetPressed = false;
|
||||||
this.ddResetStatus = r.status.toString() === "true";
|
this.ddResetStatus = r.status;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.ddResetStatus = null;
|
this.ddResetStatus = null;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|||||||
@@ -81,10 +81,10 @@
|
|||||||
body: JSON.stringify(this.passwordData),
|
body: JSON.stringify(this.passwordData),
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (r.status == 200) {
|
if (r.status === 200) {
|
||||||
r.json().then((rj) => {
|
r.json().then((rj) => {
|
||||||
if (rj.status.toString() === "true") {
|
this.success = rj.status;
|
||||||
this.success = true;
|
if (this.success === true) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.location.reload();
|
document.location.reload();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|||||||
Reference in New Issue
Block a user