import request from '@/utils/request';

export async function updateUserInfo(params) {
  const res = await request.put('/user/userInfo', params);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function getUserInfo(params) {
  const res = await request.get('/user/userInfo', {
    params
  });
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function updateUserMobile(params) {
  const res = await request.put('/user/userInfo/mobile', params);
  if (res.data.code === 0) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
