import { GetProductsDocument } from '~/composables/graphql/public/geo-generated' // Shared state const items = ref([]) const isLoading = ref(false) const isLoadingMore = ref(false) const isInitialized = ref(false) export function useCatalogProducts() { const { execute } = useGraphQL() // Products don't have server-side pagination yet, so we load all at once const canLoadMore = computed(() => false) const fetchProducts = async () => { if (isLoading.value) return isLoading.value = true try { const data = await execute( GetProductsDocument, {}, 'public', 'geo' ) items.value = data?.products || [] isInitialized.value = true } finally { isLoading.value = false } } const loadMore = async () => { // No-op: products don't support pagination yet } const init = async () => { if (!isInitialized.value && items.value.length === 0) { await fetchProducts() } } return { items, isLoading, isLoadingMore, isInitialized, canLoadMore, fetchProducts, loadMore, init } }