mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
add inital data for language selector (#20620)
* add inital data for language selector * Update compute-initial-ha-form-data.ts
This commit is contained in:
parent
22b927d666
commit
20a3a00aec
@ -71,6 +71,10 @@ export const computeInitialHaFormData = (
|
|||||||
if (selector.country?.countries?.length) {
|
if (selector.country?.countries?.length) {
|
||||||
data[field.name] = selector.country.countries[0];
|
data[field.name] = selector.country.countries[0];
|
||||||
}
|
}
|
||||||
|
} else if ("language" in selector) {
|
||||||
|
if (selector.language?.languages?.length) {
|
||||||
|
data[field.name] = selector.language.languages[0];
|
||||||
|
}
|
||||||
} else if ("duration" in selector) {
|
} else if ("duration" in selector) {
|
||||||
data[field.name] = {
|
data[field.name] = {
|
||||||
hours: 0,
|
hours: 0,
|
||||||
@ -93,7 +97,9 @@ export const computeInitialHaFormData = (
|
|||||||
) {
|
) {
|
||||||
data[field.name] = {};
|
data[field.name] = {};
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Selector not supported in initial form data");
|
throw new Error(
|
||||||
|
`Selector ${Object.keys(selector)[0]} not supported in initial form data`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user