Payments and Addresses add- and removeable
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export class AddressModel {
|
||||
street: string = ""
|
||||
houseNumber: number = 0
|
||||
postalCode: number = 0
|
||||
houseNumber: number
|
||||
postalCode: number
|
||||
city: string = ""
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import { loginAccount, registerAccount, updateAccount } from "../api/accountApi"
|
||||
import { getUserOrders } from "../api/orderApi";
|
||||
import { BannerStateEnum } from "../enums/bannerStateEnum";
|
||||
import { calcPrice } from "@/scripts/productScripts";
|
||||
import { AddressModel } from "../models/addressModel";
|
||||
import { PaymentModel } from "../models/paymentModel";
|
||||
|
||||
export const useAccountStore = defineStore("accountStore", {
|
||||
state: () => ({
|
||||
@@ -89,6 +91,18 @@ export const useAccountStore = defineStore("accountStore", {
|
||||
}
|
||||
|
||||
return Math.round(totalPrice * 100) / 100
|
||||
},
|
||||
|
||||
removeAddress(address: AddressModel) {
|
||||
this.userAccount.addresses = this.userAccount.addresses.filter((addr: AddressModel) =>
|
||||
addr != address
|
||||
)
|
||||
},
|
||||
|
||||
removePayment(payment: PaymentModel) {
|
||||
this.userAccount.payments = this.userAccount.payments.filter((paym: PaymentModel) =>
|
||||
paym != payment
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user