user.js 818 B

12345678910111213141516171819202122232425262728
  1. import request from '../utils/request.js'
  2. class store extends request{
  3. // static errorHandel(res) {
  4. // console.log(res);
  5. // }
  6. static async userLogin(data) {
  7. const res = await this.postRequest(`${this.BASE_URL}User/save`, data)
  8. return res.data;
  9. }
  10. static async getMobile(data) {
  11. const res = await this.postRequest(`${this.BASE_URL}User/getMobile`, data)
  12. return res.data;
  13. }
  14. static async updateUserInfo(name,birthday,avatar,sex){
  15. const res = await this.postRequest(`${this.BASE_URL}User/editUser?name=${name}&birthday=${birthday}&avatar=${avatar}&sex=${sex}`)
  16. }
  17. static async getUserById(userId){
  18. const res = await this.getRequest(`${this.BASE_URL}User/read?id=${userId}`)
  19. return res.data
  20. }
  21. }
  22. export default store