mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user