From 13f6f2a451feede8037d18cfbac64843e108ccbd Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sat, 29 Jul 2023 18:26:24 +0800
Subject: ...

---
 FrontEnd/src/pages/setting/index.tsx | 42 ++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 19 deletions(-)

(limited to 'FrontEnd/src/pages/setting/index.tsx')

diff --git a/FrontEnd/src/pages/setting/index.tsx b/FrontEnd/src/pages/setting/index.tsx
index 2599f2f5..cec81530 100644
--- a/FrontEnd/src/pages/setting/index.tsx
+++ b/FrontEnd/src/pages/setting/index.tsx
@@ -282,25 +282,29 @@ export default function SettingPage() {
         open={dialog === "change-password"}
         close={() => setDialog(null)}
       />
-      <ConfirmDialog
-        title="settings.dialogConfirmLogout.title"
-        body="settings.dialogConfirmLogout.prompt"
-        onClose={() => setDialog(null)}
-        open={dialog === "logout"}
-        onConfirm={() => {
-          void userService.logout().then(() => {
-            navigate("/");
-          });
-        }}
-      />
-      <ChangeAvatarDialog
-        open={dialog === "change-avatar"}
-        close={() => setDialog(null)}
-      />
-      <ChangeNicknameDialog
-        open={dialog === "change-nickname"}
-        close={() => setDialog(null)}
-      />
+      {user && (
+        <>
+          <ConfirmDialog
+            title="settings.dialogConfirmLogout.title"
+            body="settings.dialogConfirmLogout.prompt"
+            onClose={() => setDialog(null)}
+            open={dialog === "logout"}
+            onConfirm={() => {
+              void userService.logout().then(() => {
+                navigate("/");
+              });
+            }}
+          />
+          <ChangeAvatarDialog
+            open={dialog === "change-avatar"}
+            close={() => setDialog(null)}
+          />
+          <ChangeNicknameDialog
+            open={dialog === "change-nickname"}
+            close={() => setDialog(null)}
+          />
+        </>
+      )}
     </Page>
   );
 }
-- 
cgit v1.2.3

