Config UI: auth/service improvements (#25573)

This commit is contained in:
Michael Geers 2025-11-26 13:50:57 +01:00 • committed by GitHub
parent ff6e4b838c
commit f35bebd895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 50 additions and 16 deletions

View file

@ -116,10 +116,11 @@ export function customChargerName(type: ConfigType, isHeating: boolean) {
export async function loadServiceValues(path: string) {
try {
const response = await api.get(`/config/service/${path}`);
const response = await api.get(`/config/service/${path}`, {
validateStatus: (status) => status >= 200 && status < 500,
});
return (response.data as string[]) || [];
} catch (e) {
console.error(e);
} catch {
return [];
}
}
@ -169,7 +170,10 @@ export const fetchServiceValues = async (
return;
}
const url = endpoint.url(params);
result[endpoint.name] = await loadServiceValues(url);
const data = await loadServiceValues(url);
if (data) {
result[endpoint.name] = data;
}
})
);