From 0d04bc5d8080b82338302fba0a59fccff2eaedfc Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 06 七月 2025 11:28: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