Apply review comments

This commit is contained in:
2024-12-23 15:15:24 +01:00
parent 6f003ffa53
commit 139221dd22
3 changed files with 11 additions and 18 deletions

View File

@ -1,6 +1,6 @@
import { exportToHtml } from "#core:utils/globals";
import { BasketItem } from "#counter:counter/basket";
import type { CounterConfig } from "#counter:counter/types";
import type { CounterConfig, ErrorMessage } from "#counter:counter/types";
exportToHtml("loadCounter", (config: CounterConfig) => {
document.addEventListener("alpine:init", () => {
@ -38,7 +38,7 @@ exportToHtml("loadCounter", (config: CounterConfig) => {
delete this.basket[id];
},
addToBasket(id: string, quantity: number): string {
addToBasket(id: string, quantity: number): ErrorMessage {
const item: BasketItem =
this.basket[id] || new BasketItem(config.products[id], 0);

View File

@ -1,3 +1,5 @@
type ErrorMessage = string;
export interface InitialFormData {
/* Used to refill the form when the backend raises an error */
id?: keyof Record<string, Product>;