mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 19:48:08 +00:00
* feat: setup vuelitdate for vue 2.7 * feat: add all composables * feat: return track method --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
24 lines
555 B
JavaScript
24 lines
555 B
JavaScript
import { computed } from 'vue';
|
|
import { getCurrentInstance } from 'vue';
|
|
|
|
export const useStore = () => {
|
|
const vm = getCurrentInstance();
|
|
if (!vm) throw new Error('must be called in setup');
|
|
return vm.proxy.$store;
|
|
};
|
|
|
|
export const useStoreGetters = () => {
|
|
const store = useStore();
|
|
return Object.fromEntries(
|
|
Object.keys(store.getters).map(getter => [
|
|
getter,
|
|
computed(() => store.getters[getter]),
|
|
])
|
|
);
|
|
};
|
|
|
|
export const mapGetter = key => {
|
|
const store = useStore();
|
|
return computed(() => store.getters[key]);
|
|
};
|