This commit is contained in:
2026-08-16 12:00:28 +02:00
parent 52f27e30fc
commit 52fb129957
7 changed files with 105 additions and 23 deletions
+1
View File
@@ -207,6 +207,7 @@ export type CloneCatalogResult = {
status: string;
source_company_id: string;
dest_company_id: string;
active_company_id?: string;
counts: Record<string, number>;
};
+1 -1
View File
@@ -2321,7 +2321,7 @@ export const en: MessageDict = {
"flash.admin.staffRoleUpdated": "Staff role updated for {email}.",
"flash.admin.staffRoleUnavailable": "Staff role updates are not available on this server yet.",
"flash.admin.planAssigned": "Plan assigned to {name}.",
"flash.admin.catalogCloned": "Copied {source} into {dest}: {products} products, {categories} categories.",
"flash.admin.catalogCloned": "Copied {source} into {dest}: {products} products, {categories} categories. Open Products and process catalog GTINs (EAN-only API calls need a matching feed product).",
"flash.admin.planAssignedShort": "Plan assigned.",
"flash.admin.creditsUpdated": "Credits updated.",
"flash.admin.cyclesProcessed": "Billing cycles processed: {count}",
@@ -378,6 +378,7 @@
});
const products = Number(res.counts?.raw_products ?? 0);
const categories = Number(res.counts?.categories ?? 0);
const activeDest = (res.active_company_id || res.dest_company_id || "").trim();
success = i18n.t("flash.admin.catalogCloned", {
source: cloneCompany.name,
dest: cloneDestLabel,
@@ -386,6 +387,18 @@
});
cloneOpen = false;
cloneCompany = null;
if (activeDest) {
try {
await api("/api/auth/select-company", {
method: "POST",
body: { company_id: activeDest }
});
} catch {
/* clone handler may already have switched the session */
}
window.location.assign("/products");
return;
}
} catch (err) {
error = failureMessage(err, "Clone catalog failed");
} finally {