From 247f15813f914559846109c32f3a2c0e6d373fac Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Wed, 4 Nov 2020 10:31:34 +0800
Subject: refactor: Refactor operation dialog.

---
 FrontEnd/src/app/views/admin/UserAdmin.tsx | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 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 18b77ca8..0f5f8796 100644
--- a/FrontEnd/src/app/views/admin/UserAdmin.tsx
+++ b/FrontEnd/src/app/views/admin/UserAdmin.tsx
@@ -152,16 +152,18 @@ const CreateUserDialog: React.FC<CreateUserDialogProps> = (props) => {
       title="Create"
       titleColor="create"
       inputPrompt="You are creating a new user."
-      inputScheme={[
-        { type: "text", label: "Username" },
-        { type: "text", label: "Password" },
-        { type: "bool", label: "Administrator" },
-      ]}
+      inputScheme={
+        [
+          { type: "text", label: "Username" },
+          { type: "text", label: "Password" },
+          { type: "bool", label: "Administrator" },
+        ] as const
+      }
       onProcess={([username, password, administrator]) =>
         props.process({
-          username: username as string,
-          password: password as string,
-          administrator: administrator as boolean,
+          username: username,
+          password: password,
+          administrator: administrator,
         })
       }
       close={props.close}
@@ -221,7 +223,7 @@ const UserChangeUsernameDialog: React.FC<UserModifyDialogProps<string>> = (
       )}
       inputScheme={[{ type: "text", label: "New Username" }]}
       onProcess={([newUsername]) => {
-        return props.process(newUsername as string);
+        return props.process(newUsername);
       }}
     />
   );
@@ -245,7 +247,7 @@ const UserChangePasswordDialog: React.FC<UserModifyDialogProps<string>> = (
       )}
       inputScheme={[{ type: "text", label: "New Password" }]}
       onProcess={([newPassword]) => {
-        return props.process(newPassword as string);
+        return props.process(newPassword);
       }}
     />
   );
-- 
cgit v1.2.3

