|
|
|
@@ -143,18 +143,18 @@ const ItemPriceSearch: ItemPriceSearchComponent = () => { |
|
|
|
const data = res.data; |
|
|
|
if (!data.success) { |
|
|
|
const errMsg = |
|
|
|
data.errors?.length > 0 |
|
|
|
? `${t("Upload failed", { ns: "common" })}\n\n${data.errors.join("\n")}` |
|
|
|
(data.errors?.length ?? 0) > 0 |
|
|
|
? `${t("Upload failed", { ns: "common" })}\n\n${(data.errors ?? []).join("\n")}` |
|
|
|
: t("Upload failed", { ns: "common" }); |
|
|
|
alert(errMsg); |
|
|
|
return; |
|
|
|
} |
|
|
|
const updated = data.updated ?? 0; |
|
|
|
if (data.errors?.length) { |
|
|
|
if ((data.errors?.length ?? 0) > 0) { |
|
|
|
const successLabel = t("Upload successful", { ns: "common" }); |
|
|
|
const countLabel = t("item(s) updated", { ns: "common" }); |
|
|
|
const rowErrorsLabel = t("Upload row errors", { ns: "common" }); |
|
|
|
const msg = `${successLabel} ${updated} ${countLabel}\n\n${rowErrorsLabel}\n${data.errors.join("\n")}`; |
|
|
|
const msg = `${successLabel} ${updated} ${countLabel}\n\n${rowErrorsLabel}\n${(data.errors ?? []).join("\n")}`; |
|
|
|
alert(msg); |
|
|
|
} else { |
|
|
|
alert(t("Upload successful", { ns: "common" })); |
|
|
|
|