Explorar o código

add description

kaori %!s(int64=3) %!d(string=hai) anos
pai
achega
9d6ec6fece
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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;