Config UI: fix network errors on restart (2) (#26770)

This commit is contained in:
Michael Geers 2026-01-18 12:04:20 +01:00 • committed by GitHub
parent fe5276bd35
commit 5331de7a61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -788,8 +788,8 @@ export default defineComponent({
this.updateValues();
},
async loadDirty() {
const response = await api.get("/config/dirty");
if (response.data) {
const data = await this.loadConfig("dirty");
if (data) {
restart.restartNeeded = true;
}
},
@ -1045,9 +1045,14 @@ export default defineComponent({
},
async updateDeviceValue(type: DeviceType, name: string) {
try {
const response = await api.get(`/config/devices/${type}/${name}/status`);
if (!this.deviceValues[type]) this.deviceValues[type] = {};
this.deviceValues[type][name] = response.data;
const validateStatus = (status: number) => [200, 404].includes(status);
const response = await api.get(`/config/devices/${type}/${name}/status`, {
validateStatus,
});
if (response.status === 200) {
if (!this.deviceValues[type]) this.deviceValues[type] = {};
this.deviceValues[type][name] = response.data;
}
} catch (error) {
console.error("Error fetching device values for", type, name, error);
}