MED-197: improve analysis compare page

This commit is contained in:
Danel Kungla
2025-10-07 18:07:59 +03:00
parent 258bd62a7f
commit 57f992a5c3
14 changed files with 218 additions and 18 deletions

View File

@@ -7,6 +7,8 @@ import { sdk } from '@lib/config';
import medusaError from '@lib/util/medusa-error';
import { HttpTypes, StoreCart } from '@medusajs/types';
import { getLogger } from '@kit/shared/logger';
import {
getAuthHeaders,
getCacheOptions,
@@ -135,13 +137,21 @@ export async function addToCart({
quantity: number;
countryCode: string;
}) {
const logger = await getLogger();
const ctx = {
variantId,
quantity,
countryCode,
};
if (!variantId) {
logger.error(ctx, 'Missing variant ID when adding to cart');
throw new Error('Missing variant ID when adding to cart');
}
const cart = await getOrSetCart(countryCode);
if (!cart) {
logger.error(ctx, 'Error retrieving or creating cart');
throw new Error('Error retrieving or creating cart');
}