@empathyco/x-components
Version:
Empathy X Components
22 lines (19 loc) • 550 B
JavaScript
import { computed } from 'vue';
import { useStore } from 'vuex';
/**
* Function which returns the requested state's properties as a dictionary.
* @param module - The {@link XModuleName} of the getter.
* @returns A dictionary of computed state properties of the module.
*
* @public
*/
function useState(module) {
const store = useStore();
return new Proxy({}, {
get(_obj, path) {
return computed(() => store?.state.x[module]?.[path]);
},
});
}
export { useState };
//# sourceMappingURL=use-state.js.map