From d835d1b51f832889929cdf69010034a30ef44d02 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:57:29 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/User/Login/index.jsx |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/zy-asrs-flow/src/pages/User/Login/index.jsx b/zy-asrs-flow/src/pages/User/Login/index.jsx
index 091aed2..c32f457 100644
--- a/zy-asrs-flow/src/pages/User/Login/index.jsx
+++ b/zy-asrs-flow/src/pages/User/Login/index.jsx
@@ -90,15 +90,17 @@
     useEffect(() => {
         const fetchHostList = async () => {
             const resp = await Http.doGet('api/auth/host');
-            const list = resp.data.map(item => ({
-                label: item.name,
-                value: item.id
-            }));
-            setHostList(list);
-            if (list && list.length > 0) {
-                form.setFieldsValue({
-                    hostId: list[0].value
-                });
+            if (resp?.data) {
+                const list = resp.data.map(item => ({
+                    label: item.name,
+                    value: item.id
+                }));
+                setHostList(list);
+                if (list && list.length > 0) {
+                    form.setFieldsValue({
+                        hostId: list[0].value
+                    });
+                }
             }
         }
         fetchHostList();

--
Gitblit v1.9.1