fix: errors
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import ProductsView from '@/views/customer/ProductsView.vue';
|
||||
import LangSwitch from './inner/langSwitch.vue'
|
||||
import ThemeSwitch from './inner/themeSwitch.vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
@@ -134,7 +134,12 @@ function openCreateModal() {
|
||||
}
|
||||
|
||||
function openEditModal(address: any) {
|
||||
formData.value = { ...address }
|
||||
formData.value = {
|
||||
street: address.street,
|
||||
zipCode: address.zipCode,
|
||||
city: address.city,
|
||||
country: address.country
|
||||
}
|
||||
isEditing.value = true
|
||||
editingAddressId.value = address.id
|
||||
showModal.value = true
|
||||
|
||||
@@ -86,16 +86,18 @@ export const useAddressStore = defineStore('address', () => {
|
||||
|
||||
function updateAddress(id: number, formData: AddressFormData): boolean {
|
||||
const index = addresses.value.findIndex(a => a.id === id)
|
||||
if (index === -1) return false
|
||||
if (index === -1) return false
|
||||
|
||||
const existing = addresses.value[index]
|
||||
if (!existing) return false
|
||||
|
||||
addresses.value[index] = {
|
||||
...addresses.value[index],
|
||||
id: existing.id,
|
||||
...normalize(formData)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function deleteAddress(id: number): boolean {
|
||||
const index = addresses.value.findIndex(a => a.id === id)
|
||||
if (index === -1) return false
|
||||
|
||||
@@ -15,8 +15,6 @@ import { useAuthStore } from '@/stores/auth'
|
||||
import { i18n } from '@/plugins/02_i18n'
|
||||
import type { TableColumn } from '@nuxt/ui'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import ProductDetailView from './customer/ProductDetailView.vue'
|
||||
import ProductsView from './customer/ProductsView.vue'
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user