feat(MED-85): create customer group for company account in Medusa

This commit is contained in:
2025-08-25 11:51:12 +03:00
parent 5108087cc5
commit 89d6035151
8 changed files with 109 additions and 4 deletions

View File

@@ -276,6 +276,12 @@ export async function medusaLoginOrRegister(credentials: {
const customerCacheTag = await getCacheTag("customers");
revalidateTag(customerCacheTag);
const customer = await retrieveCustomer();
if (!customer) {
throw new Error("Customer not found");
}
return customer.id;
} catch (error) {
console.error("Failed to login customer, attempting to register", error);
try {
@@ -302,6 +308,12 @@ export async function medusaLoginOrRegister(credentials: {
const customerCacheTag = await getCacheTag("customers");
revalidateTag(customerCacheTag);
await transferCart();
const customer = await retrieveCustomer();
if (!customer) {
throw new Error("Customer not found");
}
return customer.id;
} catch (registerError) {
throw medusaError(registerError);
}