import axios from 'axios';

function getRequest(url, params) {
  return axios({
    method: 'get',
    url: `${window.origin}${url}`,
    data: {},
    params: params,
    headers: { 'content-type': 'application/x-www-form-urlencoded' } // "token": token
  });
}

export function getAccountStateInfo() {
  return getRequest('api-marketing/account-state-info', {
    requestProject: 'haoban-manage-web'
  });
}

export function getExpireData(params) {
  params = params || {};
  let dmUserInfo = JSON.parse(sessionStorage.getItem('userInfos'));
  let serviceType = 1;
  return getRequest('/api-admin/enterprise_expirebar', {
    requestProject: 'haoban-manage-web',
    serviceType: serviceType,
    isSuperAdmin: dmUserInfo.superAdmin,
    enterpriseId: dmUserInfo.enterpriseId,
    ...params
  });
}
