fix(机柜管理): 处理获取机房列表时可能的数据未定义问题
This commit is contained in:
@@ -346,7 +346,7 @@ function RackManagement() {
|
|||||||
const fetchRooms = useCallback(async () => {
|
const fetchRooms = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('/api/rooms');
|
const response = await axios.get('/api/rooms');
|
||||||
setRooms(response.data);
|
setRooms(response.data.rooms || []);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error('获取机房列表失败');
|
message.error('获取机房列表失败');
|
||||||
console.error('获取机房列表失败:', error);
|
console.error('获取机房列表失败:', error);
|
||||||
|
|||||||
Reference in New Issue
Block a user