mirror of
https://github.com/vercel/commerce.git
synced 2025-06-08 01:06: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 type { CheckoutEndpoint } from '.'
|
||||||
|
import { Orders } from '@commercelayer/sdk'
|
||||||
import getCredentials from '../../utils/getCredentials'
|
import getCredentials from '../../utils/getCredentials'
|
||||||
import Order from '@commercelayer/sdk'
|
|
||||||
|
|
||||||
const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
||||||
req,
|
req,
|
||||||
@ -18,7 +18,7 @@ const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
|||||||
|
|
||||||
const { ENDPOINT } = getCredentials()
|
const { ENDPOINT } = getCredentials()
|
||||||
if (orderId && accessToken) {
|
if (orderId && accessToken) {
|
||||||
const clOrder = await Order.withCredentials({ ENDPOINT, accessToken })
|
const clOrder = await Orders.withCredentials({ ENDPOINT, accessToken })
|
||||||
.includes('lineItems')
|
.includes('lineItems')
|
||||||
.find(orderId as string, { rawResponse: true })
|
.find(orderId as string, { rawResponse: true })
|
||||||
const checkoutUrl = clOrder.data.attributes.checkout_url
|
const checkoutUrl = clOrder.data.attributes.checkout_url
|
||||||
|
@ -16,10 +16,10 @@ export function getOrganizationSlug<E extends string>(endpoint: E): ReturnObj {
|
|||||||
organization: '',
|
organization: '',
|
||||||
domain: 'commercelayer.io',
|
domain: 'commercelayer.io',
|
||||||
}
|
}
|
||||||
if (endpoint) {
|
if (ENDPOINT) {
|
||||||
if (endpoint.search('commercelayer.io') === -1)
|
if (ENDPOINT.search('commercelayer.io') === -1)
|
||||||
org.domain = 'commercelayer.co'
|
org.domain = 'commercelayer.co'
|
||||||
org.organization = endpoint
|
org.organization = ENDPOINT
|
||||||
.replace('https://', '')
|
.replace('https://', '')
|
||||||
.replace(`.${org.domain}`, '')
|
.replace(`.${org.domain}`, '')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user