Use websocket endpoint to fetch config entries (#12964)

This commit is contained in:
J. Nick Koston 2022-06-21 13:10:39 -05:00 committed by GitHub
parent 05346ae9fc
commit 3633daa814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,19 +38,19 @@ export const getConfigEntries = (
hass: HomeAssistant, hass: HomeAssistant,
filters?: { type?: "helper" | "integration"; domain?: string } filters?: { type?: "helper" | "integration"; domain?: string }
): Promise<ConfigEntry[]> => { ): Promise<ConfigEntry[]> => {
const params = new URLSearchParams(); const params: any = {};
if (filters) { if (filters) {
if (filters.type) { if (filters.type) {
params.append("type", filters.type); params.type_filter = filters.type;
} }
if (filters.domain) { if (filters.domain) {
params.append("domain", filters.domain); params.domain = filters.domain;
} }
} }
return hass.callApi<ConfigEntry[]>( return hass.callWS<ConfigEntry[]>({
"GET", type: "config_entries/get",
`config/config_entries/entry?${params.toString()}` ...params,
); });
}; };
export const updateConfigEntry = ( export const updateConfigEntry = (