@hakit/core
Version:
A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.
12 lines (11 loc) • 621 B
JavaScript
import { getCollection as i, getUser as o } from "home-assistant-js-websocket";
const n = async (e, { includeSystemGenerated: s = !1, includeInactiveUsers: r = !1 } = {}) => (await e.sendMessagePromise({ type: "config/auth/list" })).filter((c) => !(!s && c.system_generated || !r && !c.is_active)), f = (e, s, r) => (n(e, r).then(s).catch((t) => {
console.warn("subscribeUsers: failed to fetch users", t), s([]);
}), () => {
}), u = (e) => i(e, "_usr", () => o(e), void 0), l = (e, s) => u(e).subscribe(s);
export {
l as subscribeUser,
f as subscribeUsers,
u as userCollection
};
//# sourceMappingURL=user.js.map