fix: endpoint

This commit is contained in:
Victor Gerbrands 2023-05-08 14:42:08 +02:00
parent 9f9ffe4ac9
commit 60ab70843d

View File

@ -18,8 +18,7 @@ import {
SelectedOption SelectedOption
} from './types'; } from './types';
// const endpoint = `${process.env.MEDUSA_BACKEND_API!}`; const ENDPOINT = process.env.MEDUSA_BACKEND_API;
const endpoint = `http://localhost:9000/store`;
export default async function medusaRequest( export default async function medusaRequest(
method: string, method: string,
@ -38,7 +37,7 @@ export default async function medusaRequest(
} }
try { try {
const result = await fetch(`${endpoint}/${path}`, options); const result = await fetch(`${ENDPOINT}${path}`, options);
const body = await result.json(); const body = await result.json();
@ -144,9 +143,9 @@ const reshapeLineItem = (lineItem: MedusaLineItem): CartItem => {
totalAmount: { totalAmount: {
amount: convertToDecimal( amount: convertToDecimal(
lineItem.total, lineItem.total,
lineItem.variant.prices?.[0]?.currency_code lineItem.variant?.prices?.[0]?.currency_code
).toString(), ).toString(),
currencyCode: 'EUR' currencyCode: lineItem.variant?.prices?.[0]?.currency_code || 'EUR'
} }
}; };
const quantity = lineItem.quantity; const quantity = lineItem.quantity;