From 30d8d28475298a6b620b682a7437022d3b818c80 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Mon, 13 Apr 2026 17:07:29 +0300 Subject: [PATCH] fix: show API error details in menu editor save + allow tg:// URLs Save mutation was showing generic error instead of backend validation detail, making it impossible to diagnose 422 errors. Also added tg:// to frontend URL validation for Telegram deep link support. --- src/components/admin/MenuEditorTab.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/admin/MenuEditorTab.tsx b/src/components/admin/MenuEditorTab.tsx index 15baf1e..3548762 100644 --- a/src/components/admin/MenuEditorTab.tsx +++ b/src/components/admin/MenuEditorTab.tsx @@ -573,8 +573,10 @@ export function MenuEditorTab() { setDraftConfig(data); queryClient.setQueryData(['menu-layout'], data); }, - onError: () => { - notify.error(t('common.error')); + onError: (err: unknown) => { + const error = err as { response?: { data?: { detail?: string } } }; + const detail = error.response?.data?.detail; + notify.error(detail || t('common.error')); }, }); @@ -748,7 +750,12 @@ export function MenuEditorTab() { for (const row of currentDraft.rows) { for (const btn of row.buttons) { if (btn.type === 'custom') { - if (!btn.url || (!btn.url.startsWith('http://') && !btn.url.startsWith('https://'))) { + if ( + !btn.url || + (!btn.url.startsWith('http://') && + !btn.url.startsWith('https://') && + !btn.url.startsWith('tg://')) + ) { notify.error(t('admin.menuEditor.invalidUrl')); return; }