import {ref} from "vue"; import {usePointsOfInterestStore} from "stores/PointsOfInterest"; import {storeToRefs} from "pinia"; export const loading = ref(true); export const poi = ref(null); export const fetchPoi = (poiId) => { loading.value = true; return usePointsOfInterestStore().fetchDetail(poiId) .then(data => { poi.value = data; return data; }) .finally(() => loading.value = false); }; export const pointsOfInterest = storeToRefs(usePointsOfInterestStore()).items; export const fetchPOIList = () => { loading.value = true; return usePointsOfInterestStore().fetch().finally(() => loading.value = false); }