(feat): create aquilacms provider

(style): replace all bigcommerce name by aquilacms
This commit is contained in:
Gérard Le Cloerec
2021-03-23 14:42:05 +01:00
parent f770ad7a91
commit 94861a922a
81 changed files with 9204 additions and 348 deletions

View File

@@ -0,0 +1,34 @@
import { GetCustomerIdQuery } from '../schema'
import { AquilacmsConfig, getConfig } from '../api'
export const getCustomerIdQuery = /* GraphQL */ `
query getCustomerId {
customer {
entityId
}
}
`
async function getCustomerId({
customerToken,
config,
}: {
customerToken: string
config?: AquilacmsConfig
}): Promise<number | undefined> {
config = getConfig(config)
const { data } = await config.fetch<GetCustomerIdQuery>(
getCustomerIdQuery,
undefined,
{
headers: {
cookie: `${config.customerCookie}=${customerToken}`,
},
}
)
return data?.customer?.entityId
}
export default getCustomerId