forked from crowetic/commerce
Run login after creating the customer
This commit is contained in:
parent
7db006f64a
commit
ed879f8b2c
@ -49,6 +49,7 @@ const getProducts: ProductsHandlers['getProducts'] = async ({
|
||||
// We want the GraphQL version of each product
|
||||
const graphqlData = await getAllProducts({
|
||||
variables: { first: LIMIT, entityIds },
|
||||
config,
|
||||
})
|
||||
// Put the products in an object that we can use to get them by id
|
||||
const productsById = graphqlData.products.reduce<{
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { BigcommerceApiError } from '../../utils/errors'
|
||||
import { CustomersHandlers } from '..'
|
||||
import login from '../../operations/login'
|
||||
import type { CustomersHandlers } from '..'
|
||||
|
||||
const createCustomer: CustomersHandlers['createCustomer'] = async ({
|
||||
res,
|
||||
@ -54,6 +55,12 @@ const createCustomer: CustomersHandlers['createCustomer'] = async ({
|
||||
throw error
|
||||
}
|
||||
|
||||
console.log('DATA', result.data)
|
||||
|
||||
const loginData = await login({ variables: { email, password }, config })
|
||||
|
||||
console.log('LOGIN DATA', loginData)
|
||||
|
||||
res.status(200).json({ data: result.data ?? null })
|
||||
}
|
||||
|
||||
|
9
lib/bigcommerce/schema.d.ts
vendored
9
lib/bigcommerce/schema.d.ts
vendored
@ -1926,3 +1926,12 @@ export type GetSiteInfoQuery = { __typename?: 'Query' } & {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type LoginMutationVariables = Exact<{
|
||||
email: Scalars['String']
|
||||
password: Scalars['String']
|
||||
}>
|
||||
|
||||
export type LoginMutation = { __typename?: 'Mutation' } & {
|
||||
login: { __typename?: 'LoginResult' } & Pick<LoginResult, 'result'>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user