index.ts 464 B

12345678910111213141516171819202122
  1. import { RSA } from "@/utils/crypto";
  2. import { post, Result } from "../base";
  3. /**
  4. * 用户登录换取token
  5. * @param username 用户名
  6. * @param password 密码
  7. */
  8. export function login(username: string, password: string) {
  9. return post<any, Result<any>>("/auth/login", {
  10. username: username,
  11. password: RSA.encrypt(password)
  12. });
  13. }
  14. /**
  15. * 登出
  16. *
  17. * @returns .
  18. */
  19. export function logout() {
  20. return post<any, Result<any>>("/auth/logout", {});
  21. }