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:
@@ -14,8 +14,8 @@
|
||||
>
|
||||
<template #cards>
|
||||
<HubCard
|
||||
v-for="hub in items"
|
||||
:key="hub.uuid"
|
||||
v-for="(hub, index) in items"
|
||||
:key="hub.uuid ?? index"
|
||||
:hub="hub"
|
||||
selectable
|
||||
:is-selected="selectedItemId === hub.uuid"
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useLocationStore } from '~/stores/location'
|
||||
import type { CatalogHubItem, CatalogNearestHubItem } from '~/composables/useCatalogHubs'
|
||||
|
||||
definePageMeta({
|
||||
layout: false
|
||||
@@ -64,7 +65,8 @@ await init()
|
||||
const mapRef = ref<{ flyTo: (lat: number, lng: number, zoom?: number) => void } | null>(null)
|
||||
const selectedItemId = ref<string | null>(null)
|
||||
|
||||
const selectItem = async (item: any) => {
|
||||
const selectItem = async (item: CatalogHubItem | CatalogNearestHubItem) => {
|
||||
if (!item.uuid) return
|
||||
selectedItemId.value = item.uuid
|
||||
|
||||
if (item.latitude && item.longitude) {
|
||||
@@ -73,7 +75,7 @@ const selectItem = async (item: any) => {
|
||||
|
||||
// Selection logic
|
||||
if (isSearchMode.value) {
|
||||
searchStore.setLocation(item.name)
|
||||
searchStore.setLocation(item.name ?? '')
|
||||
searchStore.setLocationUuid(item.uuid)
|
||||
if (route.query.after === 'request' && searchStore.searchForm.productUuid && searchStore.searchForm.locationUuid) {
|
||||
const query: Record<string, string> = {
|
||||
@@ -92,7 +94,7 @@ const selectItem = async (item: any) => {
|
||||
return
|
||||
}
|
||||
|
||||
const success = await locationStore.select('hub', item.uuid, item.name, item.latitude, item.longitude)
|
||||
const success = await locationStore.select('hub', item.uuid, item.name ?? '', item.latitude ?? 0, item.longitude ?? 0)
|
||||
if (success) router.push(localePath('/select-location'))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user