This commit is contained in:
2026-10-25 23:25:54 +08:00
parent c178ea5160
commit c5a6ada6a6
19 changed files with 679 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import request from '@/utils/request'
import type { LoginForm, LoginResult, UserInfo } from '@/types/auth'
import type { RouteVO } from '@/types/router'
const BASE_URL = '/auth'
export const AuthAPI = {
/** 登录 */
login(data: LoginForm) {
return request<LoginResult>({ url: `${BASE_URL}/login`, method: 'post', data })
},
/** 登出 */
logout() {
return request<boolean>({ url: `${BASE_URL}/logout`, method: 'post' })
},
/** 获取当前登录用户信息(含角色与权限) */
getMe() {
return request<UserInfo>({ url: `${BASE_URL}/me`, method: 'get' })
},
/** 获取当前用户可访问的菜单路由 */
getRoutes() {
return request<RouteVO[]>({ url: `${BASE_URL}/routes`, method: 'get' })
},
}