commerce/framework/aquilacms/customer/get-customer-id.ts
Gérard Le Cloerec 3f41969f5c feat: disable Wishlist
chore: setup commerce & next config
fix: replace all call to bigcommerce from aquilacms provider
feat add validation to input in signup
2021-04-06 15:08:19 +02:00

26 lines
531 B
TypeScript

import { AquilacmsConfig, getConfig } from '../api'
import { AquilacmsUser } from '../types'
async function getCustomerId({
customerToken,
config,
}: {
customerToken: string
config?: AquilacmsConfig
}): Promise<string | undefined> {
config = getConfig(config)
const data: AquilacmsUser = await config.storeApiFetch('/v2/user', {
method: 'POST',
body: JSON.stringify({
PostBody: {},
}),
headers: {
authorization: customerToken,
},
})
return data._id
}
export default getCustomerId