refactor: remove any types and fix TypeScript errors
All checks were successful
Build Docker Image / build (push) Successful in 3m59s
All checks were successful
Build Docker Image / build (push) Successful in 3m59s
- Export InfoProductItem, InfoHubItem, InfoSupplierItem, InfoOfferItem types - Update InfoEntity interface to have explicit fields (no index signature) - Export CatalogHubItem, CatalogNearestHubItem from useCatalogHubs - Fix MapItem interfaces to accept nullable GraphQL types - Fix v-for :key bindings to handle null uuid - Add null guards in select-location pages - Update HubCard to accept nullable transportTypes - Add shims.d.ts for missing module declarations
This commit is contained in:
@@ -78,6 +78,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useLocationStore } from '~/stores/location'
|
||||
import type { CatalogHubItem, CatalogNearestHubItem } from '~/composables/useCatalogHubs'
|
||||
import type { TeamAddress } from '~/composables/graphql/team/teams-generated'
|
||||
|
||||
definePageMeta({
|
||||
layout: 'topnav'
|
||||
@@ -107,20 +109,20 @@ const {
|
||||
} = useCatalogHubs()
|
||||
|
||||
// Selected/hovered hub for map
|
||||
const selectedHubId = ref<string>()
|
||||
const hoveredHubId = ref<string>()
|
||||
const selectedHubId = ref<string | undefined>()
|
||||
const hoveredHubId = ref<string | undefined>()
|
||||
|
||||
await init()
|
||||
|
||||
// Load team addresses
|
||||
const teamAddresses = ref<any[]>([])
|
||||
const teamAddresses = ref<TeamAddress[]>([])
|
||||
|
||||
if (isAuthenticated.value) {
|
||||
try {
|
||||
const { execute } = useGraphQL()
|
||||
const { GetTeamAddressesDocument } = await import('~/composables/graphql/team/teams-generated')
|
||||
const data = await execute(GetTeamAddressesDocument, {}, 'team', 'teams')
|
||||
teamAddresses.value = data?.teamAddresses || []
|
||||
teamAddresses.value = (data?.teamAddresses || []).filter((a): a is TeamAddress => a != null)
|
||||
} catch {
|
||||
// Not critical
|
||||
}
|
||||
@@ -147,11 +149,12 @@ const goToRequestIfReady = () => {
|
||||
return false
|
||||
}
|
||||
|
||||
const selectHub = async (hub: any) => {
|
||||
const selectHub = async (hub: CatalogHubItem | CatalogNearestHubItem) => {
|
||||
if (!hub.uuid) return
|
||||
selectedHubId.value = hub.uuid
|
||||
|
||||
if (isSearchMode.value) {
|
||||
searchStore.setLocation(hub.name)
|
||||
searchStore.setLocation(hub.name ?? '')
|
||||
searchStore.setLocationUuid(hub.uuid)
|
||||
if (goToRequestIfReady()) return
|
||||
router.back()
|
||||
@@ -159,7 +162,7 @@ const selectHub = async (hub: any) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const success = await locationStore.select('hub', hub.uuid, hub.name, hub.latitude, hub.longitude)
|
||||
const success = await locationStore.select('hub', hub.uuid, hub.name ?? '', hub.latitude ?? 0, hub.longitude ?? 0)
|
||||
if (success) {
|
||||
router.back()
|
||||
}
|
||||
@@ -168,7 +171,7 @@ const selectHub = async (hub: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const selectAddress = async (addr: any) => {
|
||||
const selectAddress = async (addr: TeamAddress) => {
|
||||
if (isSearchMode.value) {
|
||||
searchStore.setLocation(addr.address || addr.name)
|
||||
searchStore.setLocationUuid(addr.uuid)
|
||||
@@ -178,7 +181,7 @@ const selectAddress = async (addr: any) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const success = await locationStore.select('address', addr.uuid, addr.name, addr.latitude, addr.longitude)
|
||||
const success = await locationStore.select('address', addr.uuid, addr.name, addr.latitude ?? 0, addr.longitude ?? 0)
|
||||
if (success) {
|
||||
router.back()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user