api.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import { request } from 'umi';
  4. /** 获取当前的用户 GET /api/currentUser */
  5. export async function currentUser(options?: { [key: string]: any }) {
  6. return request<API.CurrentUser>('/api/currentUser', {
  7. method: 'GET',
  8. ...(options || {}),
  9. });
  10. }
  11. /** 退出登录接口 POST /api/login/outLogin */
  12. export async function outLogin(options?: { [key: string]: any }) {
  13. return request<Record<string, any>>('/api/login/outLogin', {
  14. method: 'POST',
  15. ...(options || {}),
  16. });
  17. }
  18. /** 登录接口 POST /api/login/account */
  19. export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  20. return request<API.LoginResult>('/api/login/account', {
  21. method: 'POST',
  22. headers: {
  23. 'Content-Type': 'application/json',
  24. },
  25. data: body,
  26. ...(options || {}),
  27. });
  28. }
  29. /** 此处后端没有提供注释 GET /api/notices */
  30. export async function getNotices(options?: { [key: string]: any }) {
  31. return request<API.NoticeIconList>('/api/notices', {
  32. method: 'GET',
  33. ...(options || {}),
  34. });
  35. }
  36. /** 获取规则列表 GET /api/rule */
  37. export async function rule(
  38. params: {
  39. // query
  40. /** 当前的页码 */
  41. current?: number;
  42. /** 页面的容量 */
  43. pageSize?: number;
  44. },
  45. options?: { [key: string]: any },
  46. ) {
  47. return request<API.RuleList>('/api/rule', {
  48. method: 'GET',
  49. params: {
  50. ...params,
  51. },
  52. ...(options || {}),
  53. });
  54. }
  55. /** 新建规则 PUT /api/rule */
  56. export async function updateRule(options?: { [key: string]: any }) {
  57. return request<API.RuleListItem>('/api/rule', {
  58. method: 'PUT',
  59. ...(options || {}),
  60. });
  61. }
  62. /** 新建规则 POST /api/rule */
  63. export async function addRule(options?: { [key: string]: any }) {
  64. return request<API.RuleListItem>('/api/rule', {
  65. method: 'POST',
  66. ...(options || {}),
  67. });
  68. }
  69. /** 删除规则 DELETE /api/rule */
  70. export async function removeRule(options?: { [key: string]: any }) {
  71. return request<Record<string, any>>('/api/rule', {
  72. method: 'DELETE',
  73. ...(options || {}),
  74. });
  75. }