import { stringify } from 'qs';
import { request } from '@umijs/max';
import webpath from '@/utils/webPath';

export async function queryCurrent(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/auth/currentUser`, {
    method: 'POST',
    data: {
      ...params,
      method: 'query',
    },
  });
}
export async function queryProvince(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/area/getAreaTreeByParentid`, {
    method: 'POST',
    data: {
      ...params,
      method: 'fetch',
    },
  });
}
export async function queryCity(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/area/getAreaTreeByParentid`, {
    method: 'POST',
    data: {
      ...params,
      method: 'fetch',
    },
  });
}
export async function query() {
  return request(`/${webpath.portalwebpath}/web/api/service/accountsettings/users`);
}

export async function updateForProUser(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/prouser/update`, {
    method: 'POST',
    data: {
      ...params,
      method: 'update',
    },
  });
}

export async function sendCode(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/prouser/sendCode`, {
    method: 'POST',
    data: {
      ...params,
      method: 'query',
    },
  });
}

export async function verifyCode(params = {}) {
  return request(`/${webpath.portalwebpath}/web/api/service/prouser/verifyCode`, {
    method: 'POST',
    data: {
      ...params,
      method: 'query',
    },
  });
}
