Simplify GEO API - use new list endpoints and routes in nearestOffers
All checks were successful
Build Docker Image / build (push) Successful in 4m11s
All checks were successful
Build Docker Image / build (push) Successful in 4m11s
- Replace GetNodesDocument with HubsListDocument in useCatalogHubs.ts - Replace GetSupplierProfilesDocument with SuppliersListDocument in useCatalogSuppliers.ts - Replace manual grouping with ProductsListDocument in useCatalogProducts.ts - Update nearestOffers to pass hubUuid for server-side route calculation - Remove RouteToCoordinate calls - routes now included in nearestOffers response - Delete 15 obsolete GraphQL files - Add 3 new list endpoints: HubsList, SuppliersList, ProductsList - Fix TypeScript errors in CalcResultContent, LocationsContent, hubs page, location store
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { GetNodesDocument, GetHubCountriesDocument, NearestHubsDocument } from '~/composables/graphql/public/geo-generated'
|
||||
import { HubsListDocument, GetHubCountriesDocument, NearestHubsDocument } from '~/composables/graphql/public/geo-generated'
|
||||
|
||||
const PAGE_SIZE = 24
|
||||
|
||||
@@ -74,38 +74,29 @@ export function useCatalogHubs() {
|
||||
return
|
||||
}
|
||||
|
||||
// Default: fetch all hubs with filters
|
||||
// Default: fetch all hubs with filters using hubsList
|
||||
const transportType = selectedFilter.value === 'all' ? null : selectedFilter.value
|
||||
const country = selectedCountry.value === 'all' ? null : selectedCountry.value
|
||||
const bounds = filterBounds.value
|
||||
|
||||
// Validate bounds coordinates
|
||||
const validBounds = bounds &&
|
||||
typeof bounds.west === 'number' && isFinite(bounds.west) &&
|
||||
typeof bounds.south === 'number' && isFinite(bounds.south) &&
|
||||
typeof bounds.east === 'number' && isFinite(bounds.east) &&
|
||||
typeof bounds.north === 'number' && isFinite(bounds.north)
|
||||
|
||||
const data = await execute(
|
||||
GetNodesDocument,
|
||||
HubsListDocument,
|
||||
{
|
||||
limit: PAGE_SIZE,
|
||||
offset,
|
||||
transportType,
|
||||
country,
|
||||
...(validBounds ? {
|
||||
west: bounds.west,
|
||||
south: bounds.south,
|
||||
east: bounds.east,
|
||||
north: bounds.north
|
||||
} : {})
|
||||
country
|
||||
},
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
const next = data?.nodes || []
|
||||
const next = data?.hubsList || []
|
||||
items.value = replace ? next : items.value.concat(next)
|
||||
total.value = data?.nodesCount ?? total.value
|
||||
// hubsList doesn't return total count, estimate from fetched items
|
||||
if (replace) {
|
||||
total.value = next.length < PAGE_SIZE ? next.length : next.length + PAGE_SIZE
|
||||
} else if (next.length < PAGE_SIZE) {
|
||||
total.value = items.value.length
|
||||
}
|
||||
isInitialized.value = true
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
|
||||
Reference in New Issue
Block a user