From fcccacfdf429ecd012cf07f7b98673a3d320662c Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 10 Oct 2022 15:21:11 +0800 Subject: [PATCH] fix: can't access pages without permission via url (#826) (cherry picked from commit 92e71c3b01fb63f26ab905249be03a85c546c4bd) --- .../src/route-switch/antd/admin-layout/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx index 02405bb655..07adf5e65e 100644 --- a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx +++ b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx @@ -80,12 +80,22 @@ const MenuEditor = (props) => { const s = findByUid(schema, defaultSelectedUid); if (s) { setTitle(s.title); + } else { + const s = findMenuItem(schema); + if (s) { + history.push(`/admin/${s['x-uid']}`); + setTitle(s.title); + } else { + history.push(`/admin/`); + } } } else { const s = findMenuItem(schema); if (s) { history.push(`/admin/${s['x-uid']}`); setTitle(s.title); + } else { + history.push(`/admin/`); } } },