mirror of
https://github.com/vercel/commerce.git
synced 2025-05-20 08:26:59 +00:00
fix: endpoint
This commit is contained in:
parent
9f9ffe4ac9
commit
60ab70843d
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user