system.api.ts 816 B

123456789101112131415161718192021222324252627282930313233
  1. import { http } from '@/api/http'
  2. import { httpErrorHandle } from '@/utils'
  3. import { RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
  4. // * 登录
  5. export const loginApi = async (data: object) => {
  6. try {
  7. const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.SYSTEM}/login`, data);
  8. return res;
  9. } catch(err) {
  10. httpErrorHandle();
  11. }
  12. }
  13. // * 登出
  14. export const logoutApi = async () => {
  15. try {
  16. const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`);
  17. return res;
  18. } catch(err) {
  19. httpErrorHandle();
  20. }
  21. }
  22. // * 获取 oss 上传接口
  23. export const ossUrlApi = async (data: object) => {
  24. try {
  25. const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/getOssInfo`, data);
  26. return res;
  27. } catch(err) {
  28. httpErrorHandle();
  29. }
  30. }