You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
git/scr/miniprogram-2/services/usercenter/fetchPerson.js

29 lines
745 B

import { config } from '../../config/index';
/** 获取个人中心信息 */
function mockFetchPerson() {
const { delay } = require('../_utils/delay');
const { genSimpleUserInfo } = require('../../model/usercenter');
const { genAddress } = require('../../model/address');
const address = genAddress();
return delay().then(() => ({
...genSimpleUserInfo(),
address: {
provinceName: address.provinceName,
provinceCode: address.provinceCode,
cityName: address.cityName,
cityCode: address.cityCode,
},
}));
}
/** 获取个人中心信息 */
export function fetchPerson() {
if (config.useMock) {
return mockFetchPerson();
}
return new Promise((resolve) => {
resolve('real api');
});
}