import {
  request
} from '../_utils/request';
import {
  getStorage
} from '~/utils/storage'
const userData = getStorage('userInfo');

/** 获取个人中心详情信息 */
export function fetchPerson() {
  return new Promise((resolve, reject) => {
    request({
      url: `CustomerApi/getCustomerDetails?CustomerGuid=` + userData?.customerGuid,
      method: 'GET',
      success: function (res) {
        let personInfo = res.data;
        let data = {
          personInfo: {
            avatarUrl: personInfo.customerAvatar,
            nickName: personInfo.customerNickname,
            phoneNumber: personInfo.customerMobilePhoneNumber,
            gender : personInfo.customerGender,
          }
        };
        resolve(data);
      },
      fail: function (error) {
        reject(error);
      }
    });
  });
}