feat: 新增退出登录接口,新增全局接口封装,修改登录接口内容

This commit is contained in:
奔跑的面条
2022-05-21 17:31:01 +08:00
parent 92e1ec05d2
commit b6143bc75e
15 changed files with 161 additions and 35 deletions
+23
View File
@@ -0,0 +1,23 @@
import { http } from '@/api/http'
import { httpErrorHandle } from '@/utils'
import { RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
// * 登录
export const loginApi = async (data: object) => {
try {
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.SYSTEM}/login`, data);
return res;
} catch {
httpErrorHandle();
}
}
// * 登出
export const logoutApi = async () => {
try {
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.SYSTEM}/logout`);
return res;
} catch(err) {
httpErrorHandle();
}
}