優化 API 請求處理,增加安全性檢查以防止錯誤資料傳遞

This commit is contained in:
koko 2025-09-01 16:28:59 +08:00
parent 65ace7a093
commit 96fcd24546
4 changed files with 4 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 KiB

After

Width:  |  Height:  |  Size: 217 KiB

View File

@ -45,17 +45,8 @@ export const getSystemEnergyCostGrowth = async (building_ids) => {
}
export const getUserList = async (params = {}) => {
const {
page = 1,
pageSize = 9999999
} = params;
const requestData = {
Page: page,
PageSize: pageSize
};
const res = await instance.post(GET_USER_API, requestData);
const res = await instance.post(GET_USER_API, {});
return apihandler(res.code, res.data, {
msg: res.msg,

View File

@ -39,8 +39,8 @@ const authPages = computed(() =>
const open = ref(false);
const getSubMonitorPage = async (building_guid) => {
const res = await getAllSysSidebar(building_guid);
buildingStore.mainSubSys = res.data.history_Main_Systems;
menu_array.value = res.data.history_Main_Systems;
buildingStore.mainSubSys = res?.data?.history_Main_Systems ?? [];
menu_array.value = res?.data?.history_Main_Systems ?? [];
};
const getSubPage = async (system_type) => {
const res = await getSideBar(system_type);

View File

@ -13,7 +13,7 @@ let intervalId = null;
const getEnergyInfos = async () => {
try {
const res = await getEnergyInfo(store.selectedBuilding.building_guid);
const apiData = res.data;
const apiData = res?.data || {};
energyData.value = [
{