From d22f85818c9257839b093a6fd299f0ea00a075fa Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sat, 13 Feb 2021 22:15:15 +0800
Subject: refactor: Remove a deprecated api.

---
 FrontEnd/src/app/views/admin/UserAdmin.tsx | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

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

diff --git a/FrontEnd/src/app/views/admin/UserAdmin.tsx b/FrontEnd/src/app/views/admin/UserAdmin.tsx
index 369eaf1e..aada4d52 100644
--- a/FrontEnd/src/app/views/admin/UserAdmin.tsx
+++ b/FrontEnd/src/app/views/admin/UserAdmin.tsx
@@ -18,7 +18,6 @@ import { Trans, useTranslation } from "react-i18next";
 interface DialogProps<TData = undefined, TReturn = undefined> {
   open: boolean;
   close: () => void;
-  token: string;
   data: TData;
   onSuccess: (data: TReturn) => void;
 }
@@ -26,7 +25,6 @@ interface DialogProps<TData = undefined, TReturn = undefined> {
 const CreateUserDialog: React.FC<DialogProps<undefined, HttpUser>> = ({
   open,
   close,
-  token,
   onSuccess,
 }) => {
   return (
@@ -41,13 +39,10 @@ const CreateUserDialog: React.FC<DialogProps<undefined, HttpUser>> = ({
         ] as const
       }
       onProcess={([username, password]) =>
-        getHttpUserClient().createUser(
-          {
-            username,
-            password,
-          },
-          token
-        )
+        getHttpUserClient().post({
+          username,
+          password,
+        })
       }
       close={close}
       open={open}
@@ -280,8 +275,6 @@ const UserAdmin: React.FC<UserAdminProps> = (props) => {
     setUsersVersion(usersVersion + 1);
   };
 
-  const token = props.user.token;
-
   useEffect(() => {
     let subscribe = true;
     void getHttpUserClient()
@@ -304,7 +297,6 @@ const UserAdmin: React.FC<UserAdminProps> = (props) => {
           <CreateUserDialog
             open
             close={() => setDialog(null)}
-            token={token}
             data={undefined}
             onSuccess={updateUsers}
           />
@@ -315,7 +307,6 @@ const UserAdmin: React.FC<UserAdminProps> = (props) => {
           <UserDeleteDialog
             open
             close={() => setDialog(null)}
-            token={token}
             data={{ username: dialog.username }}
             onSuccess={updateUsers}
           />
@@ -326,7 +317,6 @@ const UserAdmin: React.FC<UserAdminProps> = (props) => {
           <UserModifyDialog
             open
             close={() => setDialog(null)}
-            token={token}
             data={{ oldUser: dialog.user }}
             onSuccess={updateUsers}
           />
@@ -337,7 +327,6 @@ const UserAdmin: React.FC<UserAdminProps> = (props) => {
           <UserPermissionModifyDialog
             open
             close={() => setDialog(null)}
-            token={token}
             data={{
               username: dialog.username,
               permissions: dialog.permissions,
-- 
cgit v1.2.3

