refactor(frontend): migrate Customer domain to centralized API services
- Replaced all direct axios imports with service layer calls across 8 customer files - Migrated core pages: home.vue, create.vue, edit.vue - Migrated profile pages: profile.vue (1100+ lines), TankEstimation.vue - Migrated supporting pages: ServicePlanEdit.vue, tank/edit.vue, list.vue Services integrated: - customerService: CRUD, descriptions, tank info, automatic status - authService: authentication and Authorize.net account management - paymentService: credit cards, transactions, payment authorization - deliveryService: delivery records and automatic delivery data - serviceService: service calls, parts, and service plans - adminService: statistics, social comments, and reports - queryService: dropdown data (customer types, states) Type safety improvements: - Updated paymentService.ts with accurate AxiosResponse types - Fixed response unwrapping to match api.ts interceptor behavior - Resolved all TypeScript errors in customer domain (0 errors) Benefits: - Consistent authentication via centralized interceptors - Standardized error handling across all API calls - Improved type safety with proper TypeScript interfaces - Single source of truth for API endpoints - Better testability through mockable services Verified with vue-tsc --noEmit - all customer domain files pass type checking
This commit is contained in:
@@ -24,13 +24,14 @@
|
||||
</li>
|
||||
|
||||
<!-- The v-for now loops through simple <li> elements -->
|
||||
<li v-for="result in searchResults" :key="result.id">
|
||||
<!--
|
||||
<li v-for="result in searchResults" :key="result.id || result.account_number">
|
||||
<!--
|
||||
We add styling directly to the router-link to make it look like a clickable list item.
|
||||
- `block`: Makes the entire area clickable, not just the text.
|
||||
-->
|
||||
<router-link
|
||||
:to="{ name: 'customerProfile', params: { id: result.id } }"
|
||||
<router-link
|
||||
v-if="result.id"
|
||||
:to="{ name: 'customerProfile', params: { id: result.id } }"
|
||||
@click="clearSearch"
|
||||
class="block p-2 rounded-lg hover:bg-base-200 focus:bg-primary focus:text-primary-content"
|
||||
>
|
||||
@@ -47,6 +48,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</router-link>
|
||||
<div v-else class="block p-2 rounded-lg">
|
||||
<div class="font-bold">{{ result.customer_first_name }} {{ result.customer_last_name }}</div>
|
||||
<div class="text-sm opacity-70">{{ result.customer_address }}</div>
|
||||
<div class="text-sm opacity-70">{{ result.customer_town }}, {{ getStateName(result.customer_state) }}</div>
|
||||
<div class="text-xs opacity-60 mt-1">{{ result.customer_phone_number }}</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user