mirror of
https://github.com/vercel/commerce.git
synced 2025-06-07 16:56:59 +00:00
chore: 🤖 use env from CONST
This commit is contained in:
parent
9e68d2efbd
commit
614369a74b
@ -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 Order.withCredentials({ ENDPOINT, accessToken })
|
||||
const clOrder = await Orders.withCredentials({ ENDPOINT, accessToken })
|
||||
.includes('lineItems')
|
||||
.find(orderId as string, { rawResponse: true })
|
||||
const checkoutUrl = clOrder.data.attributes.checkout_url
|
||||
|
@ -16,10 +16,10 @@ export function getOrganizationSlug<E extends string>(endpoint: E): ReturnObj {
|
||||
organization: '',
|
||||
domain: 'commercelayer.io',
|
||||
}
|
||||
if (endpoint) {
|
||||
if (endpoint.search('commercelayer.io') === -1)
|
||||
if (ENDPOINT) {
|
||||
if (ENDPOINT.search('commercelayer.io') === -1)
|
||||
org.domain = 'commercelayer.co'
|
||||
org.organization = endpoint
|
||||
org.organization = ENDPOINT
|
||||
.replace('https://', '')
|
||||
.replace(`.${org.domain}`, '')
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user