GetCustomer
Implements GetCustomer
Unified Method.
Source
import { defineApi, getCurrentCustomer } from "@vsf-enterprise/unified-api-commercetools";
import { getNormalizers } from "@vsf-enterprise/unified-api-commercetools/udl";
export const getCustomer = defineApi.getCustomer(async (context) => {
try {
const customer = await getCurrentCustomer(context);
const { normalizeCustomer } = getNormalizers(context);
return {
customer: normalizeCustomer(customer),
};
} catch {
return {
customer: null,
};
}
});