diff --git a/src/app/workshop/[id]/client_code.tsx b/src/app/workshop/[id]/client_code.tsx index 3406815..0c5de90 100644 --- a/src/app/workshop/[id]/client_code.tsx +++ b/src/app/workshop/[id]/client_code.tsx @@ -520,7 +520,11 @@ const EditElement = ({ bandage, onClose }: { bandage: Interfaces.Bandage, onClos return; } if (response.status === 400) { - alert(response.data.message.map((str: string) => capitalize(str)).join(', ')); + if (typeof response.data.message === 'object') { + alert(response.data.message.map((str: string) => capitalize(str)).join('\n') || `Unhandled error: ${response.status}`); + } else { + alert(response.data.message_ru || response.data.message); + } } }) } diff --git a/src/app/workshop/create/page.tsx b/src/app/workshop/create/page.tsx index b852d53..cf42014 100644 --- a/src/app/workshop/create/page.tsx +++ b/src/app/workshop/create/page.tsx @@ -232,7 +232,11 @@ const Editor = ({ onBandageChange, onColorChange, onColorableChange, onBandageCh if (response.status !== 201) { const error_el = document.getElementById('create_error') as HTMLLabelElement; if (error_el) { - error_el.innerText = response.data.message.map((str: string) => capitalize(str)).join('\n') || `Unhandled error: ${response.status}`; + if (typeof response.data.message === 'object') { + error_el.innerText = response.data.message.map((str: string) => capitalize(str)).join('\n') || `Unhandled error: ${response.status}`; + } else { + error_el.innerText = response.data.message_ru || response.data.message; + } } } else { router.replace(`/workshop/${response.data.external_id}`); @@ -259,7 +263,7 @@ const Editor = ({ onBandageChange, onColorChange, onColorableChange, onBandageCh heightVal={height} /> } -

+