user.ts
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import axios from "axios";
import type { RouteRecordNormalized } from "vue-router";
import { UserState } from "@/store/modules/user/types";
import qs from "qs";
export interface LoginData {
username: string;
password: string;
browserFlag: string;
}
export interface LoginRes {
token: string;
}
export function login(data: LoginData) {
return axios.post<LoginRes>("/auth/login", data);
}
export function getCaptcha(params: any) {
return axios.get<any>("/code", {
params,
});
}
export function getUserInfo() {
return axios.get<UserState>("/system/user/getInfo");
}
export function logout() {
return axios.delete<LoginRes>("/auth/logout");
}
export function getMenuList() {
return axios.get<RouteRecordNormalized[]>("/system/menu/getEnergyRouters");
}
// 获取主题库
export function getThemesList(params:any) {
return axios.get<any>("https://arco.design/themes/api/open/themes/list",{
params,
paramsSerializer: (obj) => {
return qs.stringify(obj);
},
});
}
export function updatePwd(params: any) {
return axios.put(`/system/user/profile/updatePwd?newPassword=${params.newPassword}&oldPassword=${params.oldPassword}`);
}