From e091115b8938731d7d23b2b694f76d2c9b2da10e Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期五, 14 二月 2025 10:46:45 +0800
Subject: [PATCH] #

---
 rsf-admin/src/page/settings/BaseSettings.jsx |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/rsf-admin/src/page/settings/BaseSettings.jsx b/rsf-admin/src/page/settings/BaseSettings.jsx
index 775e0d5..3a7ff59 100644
--- a/rsf-admin/src/page/settings/BaseSettings.jsx
+++ b/rsf-admin/src/page/settings/BaseSettings.jsx
@@ -17,6 +17,7 @@
     MenuItem,
     FormHelperText,
     CircularProgress,
+    LinearProgress,
 } from '@mui/material';
 import { updateUserInfo } from '@/api/auth';
 import avatar from '/avatar.jpg'
@@ -36,7 +37,9 @@
         formState: {
             errors,
             isDirty,
-        }
+        },
+        setError,
+        clearErrors,
     } = useForm();
 
     const [loading, setLoading] = useState(false);
@@ -68,6 +71,10 @@
                     username: data.username
                 }
                 localStorage.setItem("user", JSON.stringify(userToPersist));
+            } else if (code === 10005 || code === 10006) {
+                setError('email', {
+                    message: msg
+                })
             } else {
                 notify(msg, { type: 'error', messageArgs: { _: msg } });
             }
@@ -79,14 +86,23 @@
     }
 
     return (
-        <Box
-            sx={{
-                p: 3,
-                flex: 1,
-                overflow: 'auto',
-            }}
-        >
-            {/* https://github.com/themeselection/materio-mui-nextjs-admin-template-free/blob/main/javascript-version/src/views/account-settings/account/AccountDetails.jsx */}
+        <Box sx={{
+            position: 'relative',
+            p: 3,
+            flex: 1,
+            overflow: 'auto',
+        }}>
+            {!userInfo && (
+                <LinearProgress
+                    sx={{
+                        height: "2px",
+                        position: 'absolute',
+                        top: 0,
+                        left: 0,
+                        right: 0,
+                    }}
+                />
+            )}
             <form onSubmit={handleSubmit(onSubmit)} noValidate>
                 <Stack
                     direction='column'

--
Gitblit v1.9.1