feat: disable Wishlist

chore: setup commerce & next config
fix: replace all call to bigcommerce from aquilacms provider
feat add validation to input in signup
This commit is contained in:
Gérard Le Cloerec
2021-04-06 15:08:19 +02:00
parent 94861a922a
commit a5de31ae17
68 changed files with 2157 additions and 7640 deletions

View File

@@ -1,13 +1,5 @@
import { GetCustomerIdQuery } from '../schema'
import { AquilacmsConfig, getConfig } from '../api'
export const getCustomerIdQuery = /* GraphQL */ `
query getCustomerId {
customer {
entityId
}
}
`
import { AquilacmsUser } from '../types'
async function getCustomerId({
customerToken,
@@ -15,20 +7,19 @@ async function getCustomerId({
}: {
customerToken: string
config?: AquilacmsConfig
}): Promise<number | undefined> {
}): Promise<string | undefined> {
config = getConfig(config)
const data: AquilacmsUser = await config.storeApiFetch('/v2/user', {
method: 'POST',
body: JSON.stringify({
PostBody: {},
}),
headers: {
authorization: customerToken,
},
})
const { data } = await config.fetch<GetCustomerIdQuery>(
getCustomerIdQuery,
undefined,
{
headers: {
cookie: `${config.customerCookie}=${customerToken}`,
},
}
)
return data?.customer?.entityId
return data._id
}
export default getCustomerId