You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

auth.ts 958 B

2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. import { request } from '@umijs/max';
  2. export async function getCaptchaImg(params?: Record<string, any>, options?: Record<string, any>) {
  3. return request('/api/code', {
  4. method: 'GET',
  5. params: {
  6. ...params,
  7. },
  8. headers: {
  9. isToken: false,
  10. },
  11. ...(options || {}),
  12. });
  13. }
  14. /** 登录接口 POST /api/login/account */
  15. export async function login(body: API.LoginParams, options?: Record<string, any>) {
  16. return request<API.LoginResult>('/api/auth/login', {
  17. method: 'POST',
  18. headers: {
  19. isToken: false,
  20. 'Content-Type': 'application/json',
  21. },
  22. data: body,
  23. ...(options || {}),
  24. });
  25. }
  26. /** 退出登录接口 POST /api/login/outLogin */
  27. export async function logout() {
  28. return request<Record<string, any>>('/api/auth/logout', {
  29. method: 'DELETE',
  30. });
  31. }
  32. // 获取手机验证码
  33. export async function getMobileCaptcha(mobile: string) {
  34. return request(`/api/login/captcha?mobile=${mobile}`);
  35. }