fix: resolve TypeScript build errors for production builds

- Add local AxiosResponse/AxiosError interfaces to models.ts as workaround
  for bundler moduleResolution issues with axios types
- Update 7 payment Vue files to import axios types from local models
- Convert axios.get<T>() generic calls to typed .then() response callbacks
- Fix type narrowing in getTypeColor(), getEmployeeTypeName() functions
- Add Number() conversion for tank_size arithmetic in auto preauth
- Use 'as unknown as' for Delivery to DeliveryFormData type assertions
- Fix incorrect import paths for sidebar/footer in delivery/create.vue

Production build (npm run build) now completes successfully.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 15:33:13 -05:00
parent 079c2ac50f
commit 53086515ba
12 changed files with 65 additions and 32 deletions

View File

@@ -274,10 +274,12 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios, { AxiosResponse, AxiosError } from 'axios'
import axios from 'axios'
import authHeader from '../../../services/auth.header'
import { ServiceCall, ServicePart, CreditCard, Customer } from '../../../types/models'
import type {
AxiosResponse,
AxiosError,
WhoAmIResponse,
CardsOnFileResponse,
AuthorizeCheckResponse,
@@ -466,8 +468,8 @@ const getServicePartsForCustomer = () => {
if (!service.value.customer_id) return;
let path = `${import.meta.env.VITE_BASE_URL}/service/parts/customer/${service.value.customer_id}`;
axios.get<ServicePart[]>(path, { headers: authHeader() })
.then((response) => {
axios.get(path, { headers: authHeader() })
.then((response: AxiosResponse<ServicePart[]>) => {
serviceParts.value = response.data;
})
.catch((error: Error) => {