4
0
forked from crowetic/commerce

Add channel id to config

This commit is contained in:
Luis Alvarez 2020-10-27 00:20:11 -05:00
parent fbda3c68f8
commit a6772c136a
2 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@ export interface BigcommerceConfig extends CommerceAPIConfig {
storeApiUrl: string storeApiUrl: string
storeApiToken: string storeApiToken: string
storeApiClientId: string storeApiClientId: string
storeChannelId?: string
storeApiFetch<T>(endpoint: string, options?: RequestInit): Promise<T> storeApiFetch<T>(endpoint: string, options?: RequestInit): Promise<T>
} }
@ -18,6 +19,7 @@ const API_TOKEN = process.env.BIGCOMMERCE_STOREFRONT_API_TOKEN
const STORE_API_URL = process.env.BIGCOMMERCE_STORE_API_URL const STORE_API_URL = process.env.BIGCOMMERCE_STORE_API_URL
const STORE_API_TOKEN = process.env.BIGCOMMERCE_STORE_API_TOKEN const STORE_API_TOKEN = process.env.BIGCOMMERCE_STORE_API_TOKEN
const STORE_API_CLIENT_ID = process.env.BIGCOMMERCE_STORE_API_CLIENT_ID const STORE_API_CLIENT_ID = process.env.BIGCOMMERCE_STORE_API_CLIENT_ID
const STORE_CHANNEL_ID = process.env.BIGCOMMERCE_CHANNEL_ID
if (!API_URL) { if (!API_URL) {
throw new Error( throw new Error(
@ -73,6 +75,7 @@ const config = new Config({
storeApiUrl: STORE_API_URL, storeApiUrl: STORE_API_URL,
storeApiToken: STORE_API_TOKEN, storeApiToken: STORE_API_TOKEN,
storeApiClientId: STORE_API_CLIENT_ID, storeApiClientId: STORE_API_CLIENT_ID,
storeChannelId: STORE_CHANNEL_ID,
storeApiFetch: fetchStoreApi, storeApiFetch: fetchStoreApi,
}) })

View File

@ -1,9 +1,9 @@
import { Layout } from '@components/core' import { Layout } from '@components/core'
import { Container, Text } from '@components/ui' import { Container, Text } from '@components/ui'
import useCustomer from '@lib/bigcommerce/use-customer' import useCustomer from '@lib/bigcommerce/use-customer'
export default function Profile() { export default function Profile() {
const { data } = useCustomer() const { data } = useCustomer()
console.log(data)
return ( return (
<Container> <Container>
<Text variant="pageHeading">My Profile</Text> <Text variant="pageHeading">My Profile</Text>