chore: 🤖 use env from CONST

This commit is contained in:
Bolaji 2022-05-13 08:22:21 +01:00
parent 9e68d2efbd
commit 614369a74b
No known key found for this signature in database
GPG Key ID: 00342E72694643BB
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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}`, '')
}