mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +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);
|
setDraftConfig(data);
|
||||||
queryClient.setQueryData(['menu-layout'], data);
|
queryClient.setQueryData(['menu-layout'], data);
|
||||||
},
|
},
|
||||||
onError: () => {
|
onError: (err: unknown) => {
|
||||||
notify.error(t('common.error'));
|
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 row of currentDraft.rows) {
|
||||||
for (const btn of row.buttons) {
|
for (const btn of row.buttons) {
|
||||||
if (btn.type === 'custom') {
|
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'));
|
notify.error(t('admin.menuEditor.invalidUrl'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user