mirror of
https://github.com/vercel/commerce.git
synced 2025-06-08 01:06:59 +00:00
chore: 🤖 update ENDPOINT env in cart
This commit is contained in:
parent
614369a74b
commit
8840bb7b21
@ -1,6 +1,6 @@
|
||||
import type { CheckoutEndpoint } from '.'
|
||||
import { Orders } from '@commercelayer/sdk'
|
||||
import getCredentials from '../../utils/getCredentials'
|
||||
import { Order } from '@commercelayer/sdk'
|
||||
|
||||
const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
||||
req,
|
||||
@ -18,7 +18,7 @@ const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
||||
|
||||
const { ENDPOINT } = getCredentials()
|
||||
if (orderId && accessToken) {
|
||||
const clOrder = await Orders.withCredentials({ ENDPOINT, accessToken })
|
||||
const clOrder = await Order.withCredentials({ endpoint, accessToken })
|
||||
.includes('lineItems')
|
||||
.find(orderId as string, { rawResponse: true })
|
||||
const checkoutUrl = clOrder.data.attributes.checkout_url
|
||||
|
@ -15,8 +15,8 @@ export const handler: MutationHook<any> = {
|
||||
},
|
||||
async fetcher({ input }) {
|
||||
const localOrderId = localStorage.getItem('CL_ORDER_ID')
|
||||
const { accessToken, endpoint } = getCredentials()
|
||||
const organization = getOrganizationSlug(endpoint).organization
|
||||
const { accessToken, ENDPOINT } = getCredentials()
|
||||
const organization = getOrganizationSlug(ENDPOINT).organization
|
||||
const sdk = CLSdk({
|
||||
accessToken,
|
||||
organization,
|
||||
|
@ -16,7 +16,7 @@ export const handler: SWRHook<any> = {
|
||||
async fetcher() {
|
||||
const id = localStorage.getItem('CL_ORDER_ID') || ''
|
||||
const credentials = getCredentials()
|
||||
const organization = getOrganizationSlug(credentials.endpoint).organization
|
||||
const organization = getOrganizationSlug(credentials.ENDPOINT).organization
|
||||
const sdk = CLSdk({
|
||||
accessToken: credentials.accessToken,
|
||||
organization,
|
||||
@ -57,7 +57,6 @@ export const handler: SWRHook<any> = {
|
||||
({ useData }) =>
|
||||
() => {
|
||||
const response = useData()
|
||||
console.log('response', response)
|
||||
return useMemo(
|
||||
() =>
|
||||
Object.create(response, {
|
||||
|
@ -17,7 +17,7 @@ export const handler: MutationHook<any> = {
|
||||
async fetcher({ input: { id } }) {
|
||||
const credentials = getCredentials()
|
||||
const orderId = localStorage.getItem('CL_ORDER_ID')
|
||||
const organization = getOrganizationSlug(credentials.endpoint).organization
|
||||
const organization = getOrganizationSlug(credentials.ENDPOINT).organization
|
||||
const sdk = CLSdk({
|
||||
accessToken: credentials.accessToken,
|
||||
organization,
|
||||
|
@ -17,7 +17,7 @@ export const handler: MutationHook<any> = {
|
||||
},
|
||||
async fetcher({ input: { item, quantity } }) {
|
||||
const credentials = getCredentials()
|
||||
const organization = getOrganizationSlug(credentials.endpoint).organization
|
||||
const organization = getOrganizationSlug(credentials.ENDPOINT).organization
|
||||
const sdk = CLSdk({
|
||||
accessToken: credentials.accessToken,
|
||||
organization,
|
||||
|
Loading…
x
Reference in New Issue
Block a user