kaori 3 лет назад
Родитель
Сommit
9d6ec6fece
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      packages/app/src/pages/admin/[[...path]].page.tsx

+ 6 - 1
packages/app/src/pages/admin/[[...path]].page.tsx

@@ -87,9 +87,14 @@ const AdminMarkdownSettingsPage: NextPage<Props> = (props: Props) => {
   const router = useRouter();
   const path = router.query.path || 'home';
 
+  /*
+  *  `/admin/foo/bar` -> the name should be 'bar'
+  *  `/admin/foo`     -> the name should be 'foo'
+  *  `/admin/`        -> the name should be 'home'
+  */
   let name: string;
   if (Array.isArray(path)) {
-    name = path[1] != null ? path[1] : path[0];
+    name = path[1] || path[0];
   }
   else {
     name = path;