Config UI: auth/service improvements (#25573)
This commit is contained in:
parent
ff6e4b838c
commit
f35bebd895
2 changed files with 50 additions and 16 deletions
|
|
@ -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;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue