Files
commerce/framework/ordercloud/api/endpoints/customer/get-logged-in-customer.ts
2021-10-12 10:17:50 -05:00

35 lines
904 B
TypeScript

import { CustomerEndpoint } from "."
const getLoggedInCustomer: CustomerEndpoint['handlers']['getLoggedInCustomer'] = async ({
req,
res,
config,
}) => {
const token = req.cookies[config.customerCookie]
// if (token) {
// const { data } = await config.fetch<GetLoggedInCustomerQuery>(
// getLoggedInCustomerQuery,
// undefined,
// {
// headers: {
// cookie: `${config.customerCookie}=${token}`,
// },
// }
// )
// const { customer } = data
// if (!customer) {
// return res.status(400).json({
// data: null,
// errors: [{ message: 'Customer not found', code: 'not_found' }],
// })
// }
// return res.status(200).json({ data: { customer } })
// }
res.status(200).json({ data: null })
}
export default getLoggedInCustomer