35 lines
653 B
JavaScript
35 lines
653 B
JavaScript
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;
|
|
},
|
|
};
|
|
|
|
export default StoreApi;
|