Config UI: fix network errors on restart (2) (#26770)
This commit is contained in:
parent
fe5276bd35
commit
5331de7a61
1 changed files with 10 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue