docs: added credentials option to fetch examples (#2694)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2022-11-29 17:21:19 +02:00
1 parent a917b0a109
commit 657ada6fb0
8 files changed
+88 -24

No files matched your search

@@ -79,6 +79,7 @@ formData.append('files', file); //file is an instance of File
fetch(`<YOUR_SERVER>/admin/uploads`, { fetch(`<YOUR_SERVER>/admin/uploads`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
}, },
@@ -134,6 +135,7 @@ medusa.admin.batchJobs.create({
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs`, { fetch(`<YOUR_SERVER>/admin/batch-jobs`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -210,7 +212,9 @@ medusa.admin.batchJobs.retrieve(batchJobId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`) fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
console.log(batch_job.status, batch_job.result); console.log(batch_job.status, batch_job.result);
@@ -270,7 +274,8 @@ medusa.admin.batchJobs.confirm(batchJobId)
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, { fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, {
method: 'POST' method: 'POST',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
@@ -73,6 +73,7 @@ formData.append('files', file); //file is an instance of File
fetch(`<YOUR_SERVER>/admin/uploads`, { fetch(`<YOUR_SERVER>/admin/uploads`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
}, },
@@ -127,6 +128,7 @@ medusa.admin.batchJobs.create({
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs`, { fetch(`<YOUR_SERVER>/admin/batch-jobs`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -198,7 +200,9 @@ medusa.admin.batchJobs.retrieve(batchJobId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`) fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
console.log(batch_job.status, batch_job.result); console.log(batch_job.status, batch_job.result);
@@ -258,7 +262,8 @@ medusa.admin.batchJobs.confirm(batchJobId)
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, { fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, {
method: 'POST' method: 'POST',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
@@ -57,6 +57,7 @@ medusa.admin.customerGroups.create({
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups`, { fetch(`<SERVER_URL>/admin/customer-groups`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -107,7 +108,9 @@ medusa.admin.customerGroups.list()
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups`) fetch(`<SERVER_URL>/admin/customer-groups`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ customer_groups, limit, offset, count }) => { .then(({ customer_groups, limit, offset, count }) => {
console.log(customer_groups.length) console.log(customer_groups.length)
@@ -149,7 +152,9 @@ medusa.admin.customerGroups.retrieve(customerGroupId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`) fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ customer_group }) => { .then(({ customer_group }) => {
console.log(customer_group.id) console.log(customer_group.id)
@@ -195,6 +200,7 @@ medusa.admin.customerGroups.update(customerGroupId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`, { fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -250,7 +256,8 @@ medusa.admin.customerGroups.delete(customerGroupId)
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`, { fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ id, object, deleted }) => { .then(({ id, object, deleted }) => {
@@ -301,6 +308,7 @@ medusa.admin.customerGroups.addCustomers(customerGroupId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers/batch`, { fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers/batch`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -357,7 +365,9 @@ medusa.admin.customerGroups.listCustomers(customerGroupId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers`) fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ customers, count, offset, limit }) => { .then(({ customers, count, offset, limit }) => {
console.log(customers.length) console.log(customers.length)
@@ -409,6 +419,7 @@ medusa.admin.customerGroups.removeCustomers(customer_group_id, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers/batch`, { fetch(`<SERVER_URL>/admin/customer-groups/${customerGroupId}/customers/batch`, {
method: 'DELETE', method: 'DELETE',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -274,6 +274,7 @@ medusa.admin.batchJobs.create({
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs`, { fetch(`<YOUR_SERVER>/admin/batch-jobs`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -328,7 +329,9 @@ medusa.admin.batchJobs.retrieve(batchJobId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`) fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
console.log(batch_job.status, batch_job.result); console.log(batch_job.status, batch_job.result);
@@ -382,7 +385,8 @@ medusa.admin.batchJobs.confirm(batchJobId)
```jsx ```jsx
fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, { fetch(`<YOUR_SERVER>/admin/batch-jobs/${batchJobId}/confirm`, {
method: 'POST' method: 'POST',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ batch_job }) => { .then(({ batch_job }) => {
@@ -100,6 +100,7 @@ medusa.admin.priceLists.create({
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists`, { fetch(`<SERVER_URL>/admin/price-lists`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -186,7 +187,9 @@ medusa.admin.priceLists.retrieve(priceListId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`) fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ price_list }) => { .then(({ price_list }) => {
console.log(price_list.id) console.log(price_list.id)
@@ -230,6 +233,7 @@ medusa.admin.priceLists.update(priceListId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`, { fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -298,6 +302,7 @@ medusa.admin.priceLists.addPrices(priceListId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/prices/batch`, { fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/prices/batch`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -361,7 +366,8 @@ medusa.admin.priceLists.deleteProductPrices(priceListId, productId)
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/products/${productId}/prices`, { fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/products/${productId}/prices`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ ids, object, deleted }) => { .then(({ ids, object, deleted }) => {
@@ -401,7 +407,8 @@ medusa.admin.priceLists.deleteVariantPrices(priceListId, variantId)
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/variants/${variantId}/prices`, { fetch(`<SERVER_URL>/admin/price-lists/${priceListId}/variants/${variantId}/prices`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ ids, object, deleted }) => { .then(({ ids, object, deleted }) => {
@@ -443,7 +450,8 @@ medusa.admin.priceLists.delete(priceListId)
```jsx ```jsx
fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`, { fetch(`<SERVER_URL>/admin/price-lists/${priceListId}`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ id, object, deleted }) => { .then(({ id, object, deleted }) => {
@@ -71,6 +71,7 @@ medusa.admin.salesChannels.create({
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels`, { fetch(`<SERVER_URL>/admin/sales-channels`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -125,7 +126,9 @@ medusa.admin.salesChannels.list()
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels`) fetch(`<SERVER_URL>/admin/sales-channels`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ sales_channels, limit, offset, count }) => { .then(({ sales_channels, limit, offset, count }) => {
console.log(sales_channels.length) console.log(sales_channels.length)
@@ -165,7 +168,9 @@ medusa.admin.salesChannels.retrieve(salesChannelId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`) fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ sales_channels, limit, offset, count }) => { .then(({ sales_channels, limit, offset, count }) => {
console.log(sales_channels.length) console.log(sales_channels.length)
@@ -209,6 +214,7 @@ medusa.admin.salesChannels.update(salesChannelId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`, { fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -264,7 +270,8 @@ medusa.admin.salesChannels.delete(salesChannelId)
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`, { fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ id, object, deleted }) => { .then(({ id, object, deleted }) => {
@@ -315,6 +322,7 @@ medusa.admin.salesChannels.addProducts(salesChannelId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}/products/batch`, { fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}/products/batch`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -377,7 +385,9 @@ medusa.admin.products.list({
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/products?sales_channel_id[0]=${salesChannelId}`) fetch(`<SERVER_URL>/admin/products?sales_channel_id[0]=${salesChannelId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ products, limit, offset, count }) => { .then(({ products, limit, offset, count }) => {
console.log(products.length) console.log(products.length)
@@ -429,6 +439,7 @@ medusa.admin.salesChannels.removeProducts(salesChannelId, {
```jsx ```jsx
fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}/products/batch`, { fetch(`<SERVER_URL>/admin/sales-channels/${salesChannelId}/products/batch`, {
method: 'DELETE', method: 'DELETE',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -495,7 +506,9 @@ medusa.admin.orders.list({
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/admin/orders?sales_channel_id[0]=${salesChannelId}`) fetch(`<SERVER_URL>/admin/orders?sales_channel_id[0]=${salesChannelId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ orders, limit, offset, count }) => { .then(({ orders, limit, offset, count }) => {
console.log(orders.length) console.log(orders.length)
@@ -74,6 +74,7 @@ medusa.carts.update(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
body: JSON.stringify({ body: JSON.stringify({
shipping_address: { shipping_address: {
company, company,
@@ -125,7 +126,9 @@ medusa.shippingOptions.listCartOptions(cartId)
<TabItem value="fetch" label="Fetch API"> <TabItem value="fetch" label="Fetch API">
```jsx ```jsx
fetch(`<SERVER_URL>/store/shipping-options/${cartId}`) fetch(`<SERVER_URL>/store/shipping-options/${cartId}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ shipping_options }) => { .then(({ shipping_options }) => {
console.log(shipping_options.length); console.log(shipping_options.length);
@@ -159,6 +162,7 @@ medusa.carts.addShippingMethod(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/shipping-methods`, { fetch(`<SERVER_URL>/store/carts/${cartId}/shipping-methods`, {
method: 'POST', method: 'POST',
credentials: 'include',
body: JSON.stringify({ body: JSON.stringify({
option_id: shippingOptionId //the ID of the selected option option_id: shippingOptionId //the ID of the selected option
}), }),
@@ -204,7 +208,8 @@ medusa.carts.createPaymentSessions(cartId)
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/payment-sessions`, { fetch(`<SERVER_URL>/store/carts/${cartId}/payment-sessions`, {
method: 'POST' method: 'POST',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ cart }) => { .then(({ cart }) => {
@@ -239,6 +244,7 @@ medusa.carts.setPaymentSession(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/payment-session`, { fetch(`<SERVER_URL>/store/carts/${cartId}/payment-session`, {
method: 'POST', method: 'POST',
credentials: 'include',
body: JSON.stringify({ body: JSON.stringify({
provider_id: paymentProviderId // retrieved from the payment session selected by the customer provider_id: paymentProviderId // retrieved from the payment session selected by the customer
}), }),
@@ -293,6 +299,7 @@ medusa.carts.updatePaymentSession(cartId, paymentProviderId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/payment-sessions/${paymentProviderId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}/payment-sessions/${paymentProviderId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
body: JSON.stringify({ body: JSON.stringify({
data: { data: {
//pass any data you want to add in the `data` attribute //pass any data you want to add in the `data` attribute
@@ -339,6 +346,7 @@ medusa.carts.complete(cartId)
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/complete`, { fetch(`<SERVER_URL>/store/carts/${cartId}/complete`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
+13 -3
View File
@@ -56,7 +56,8 @@ medusa.carts.create()
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts`, { fetch(`<SERVER_URL>/store/carts`, {
method: 'POST' method: 'POST',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ cart }) => { .then(({ cart }) => {
@@ -95,6 +96,7 @@ medusa.carts.create({
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts`, { fetch(`<SERVER_URL>/store/carts`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -146,7 +148,9 @@ if (id) {
const id = localStorage.getItem('cart_id'); const id = localStorage.getItem('cart_id');
if (id) { if (id) {
fetch(`<SERVER_URL>/store/carts/${id}`) fetch(`<SERVER_URL>/store/carts/${id}`, {
credentials: 'include',
})
.then((response) => response.json()) .then((response) => response.json())
.then(({ cart }) => setCart(cart)); .then(({ cart }) => setCart(cart));
} }
@@ -187,6 +191,7 @@ medusa.carts.update(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -229,6 +234,7 @@ medusa.carts.update(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -267,6 +273,7 @@ medusa.carts.update(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -302,6 +309,7 @@ medusa.carts.lineItems.create(cartId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/line-items`, { fetch(`<SERVER_URL>/store/carts/${cartId}/line-items`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -349,6 +357,7 @@ medusa.carts.lineItems.update(cartId, lineItemId, {
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/line-items/${lineItemId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}/line-items/${lineItemId}`, {
method: 'POST', method: 'POST',
credentials: 'include',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
@@ -384,7 +393,8 @@ medusa.carts.lineItems.delete(cartId, lineItemId)
```jsx ```jsx
fetch(`<SERVER_URL>/store/carts/${cartId}/line-items/${lineItemId}`, { fetch(`<SERVER_URL>/store/carts/${cartId}/line-items/${lineItemId}`, {
method: 'DELETE' method: 'DELETE',
credentials: 'include',
}) })
.then((response) => response.json()) .then((response) => response.json())
.then(({ cart }) => setCart(cart)); .then(({ cart }) => setCart(cart));