石墨仪设备 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
665 B

  1. import httpRequest, { type BaseResponse } from "../httpRequest";
  2. export function login(params: { username: string; password: string }) {
  3. return httpRequest<BaseResponse<string>>({ url: `/api/auth/login`, method: "POST", params });
  4. }
  5. export type User = {
  6. id: number;
  7. username: string;
  8. nickname: string; // 用户显示
  9. password: string;
  10. role: number; // 1: admin
  11. };
  12. export function getUserList(params: { pageNum: number; pageSize: number }) {
  13. return httpRequest<BaseResponse<{ list: User[]; total: number }>>({ url: "/api/user/list", params });
  14. }
  15. export function getCurrentUser() {
  16. return httpRequest<BaseResponse<User>>({ url: "/api/user/current" });
  17. }