import request from '@/sheep/request'; function normalizeList(data) { if (Array.isArray(data)) { return data; } if (Array.isArray(data?.list)) { return data.list; } if (Array.isArray(data?.records)) { return data.records; } return []; } const StoreApi = { getStoreListByLocation: async (params) => { const res = await request({ url: '/trade/store/list-by-location', method: 'GET', params, custom: { showLoading: false, showError: false, }, }); if (res?.code === 0) { res.data = normalizeList(res.data); } return res; }, getStoreById: (storeId) => { return request({ url: '/trade/store/getStoreById', method: 'GET', params: { storeId, }, custom: { showLoading: false, }, }); }, }; export default StoreApi;