All checks were successful
Build Docker Image / build (push) Successful in 3m45s
- Add fitBounds to CatalogMap for auto-centering on all points - Add productUuid filter to useCatalogOffers composable - Create useCatalogProducts composable for products list - Update offers/index.vue: show products first, then offers by product - Update offers/map.vue: same two-level navigation - Add translations for new UI elements Navigation flow: /catalog/offers → product selection → offers for that product 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
849 B
TypeScript
42 lines
849 B
TypeScript
import { GetProductsDocument } from '~/composables/graphql/public/exchange-generated'
|
|
|
|
// Shared state
|
|
const items = ref<any[]>([])
|
|
const isLoading = ref(false)
|
|
const isInitialized = ref(false)
|
|
|
|
export function useCatalogProducts() {
|
|
const { execute } = useGraphQL()
|
|
|
|
const fetchProducts = async () => {
|
|
if (isLoading.value) return
|
|
isLoading.value = true
|
|
try {
|
|
const data = await execute(
|
|
GetProductsDocument,
|
|
{},
|
|
'public',
|
|
'exchange'
|
|
)
|
|
items.value = data?.getProducts || []
|
|
isInitialized.value = true
|
|
} finally {
|
|
isLoading.value = false
|
|
}
|
|
}
|
|
|
|
const init = async () => {
|
|
if (!isInitialized.value && items.value.length === 0) {
|
|
await fetchProducts()
|
|
}
|
|
}
|
|
|
|
return {
|
|
items,
|
|
isLoading,
|
|
isInitialized,
|
|
fetchProducts,
|
|
init
|
|
}
|
|
}
|