From 19ae2c2f87768e90730806bc31570aa74eb3f1b0 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sun, 1 May 2022 21:50:12 +0800
Subject: ...

---
 FrontEnd/src/views/admin/AdminNav.tsx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'FrontEnd/src/views/admin/AdminNav.tsx')

diff --git a/FrontEnd/src/views/admin/AdminNav.tsx b/FrontEnd/src/views/admin/AdminNav.tsx
index dc8b7dd0..49817cf8 100644
--- a/FrontEnd/src/views/admin/AdminNav.tsx
+++ b/FrontEnd/src/views/admin/AdminNav.tsx
@@ -1,12 +1,11 @@
 import React from "react";
-import { useParams } from "react-router-dom";
+import { useLocation } from "react-router-dom";
 
 import Tabs from "../common/tab/Tabs";
 
 const AdminNav: React.FC<{ className?: string }> = ({ className }) => {
-  const params = useParams();
-
-  const name = params.name;
+  const location = useLocation();
+  const name = location.pathname.split("/")[2] ?? "user";
 
   return (
     <Tabs
@@ -14,9 +13,9 @@ const AdminNav: React.FC<{ className?: string }> = ({ className }) => {
       activeTabName={name}
       tabs={[
         {
-          name: "users",
+          name: "user",
           text: "admin:nav.users",
-          link: "/admin/users",
+          link: "/admin/user",
         },
         {
           name: "more",
-- 
cgit v1.2.3

