auth.js 942 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * 认证相关API
  3. */
  4. import { post, get } from '@/utils/request.js';
  5. /**
  6. * 用户登录
  7. */
  8. export function loginApi(data) {
  9. return post('/auth/login', data);
  10. }
  11. /**
  12. * 用户退出
  13. */
  14. export function logoutApi() {
  15. return post('/auth/logout');
  16. }
  17. /**
  18. * 获取用户信息
  19. */
  20. export function getUserInfoApi() {
  21. return get('/auth/userinfo');
  22. }
  23. /**
  24. * 刷新Token
  25. */
  26. export function refreshTokenApi(refreshToken) {
  27. return post('/auth/refresh', { refreshToken });
  28. }
  29. /**
  30. * 修改密码
  31. */
  32. export function changePasswordApi(data) {
  33. return post('/auth/change-password', data);
  34. }
  35. /**
  36. * 重置密码
  37. */
  38. export function resetPasswordApi(data) {
  39. return post('/auth/reset-password', data);
  40. }
  41. /**
  42. * 发送验证码
  43. */
  44. export function sendCodeApi(data) {
  45. return post('/auth/send-code', data);
  46. }
  47. /**
  48. * 绑定手机号
  49. */
  50. export function bindPhoneApi(data) {
  51. return post('/auth/bind-phone', data);
  52. }