37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
// Author: fruit.com.cn
|
|
|
|
import request from '@/axios'
|
|
import type { UserType } from './types'
|
|
|
|
interface RoleParams {
|
|
roleName: string
|
|
}
|
|
|
|
export const loginApi = (data: UserType): Promise<IResponse<UserType>> => {
|
|
return request.post({ url: '/admin/auth/login', data })
|
|
}
|
|
|
|
export const loginOutApi = (): Promise<IResponse> => {
|
|
return request.post({ url: '/admin/auth/logout' })
|
|
}
|
|
|
|
/** 当前登录人信息(含实时权限) */
|
|
export const getProfileApi = (): Promise<IResponse<UserType>> => {
|
|
return request.get({ url: '/admin/auth/profile' })
|
|
}
|
|
|
|
export const getAdminRoleApi = (
|
|
params: RoleParams
|
|
): Promise<IResponse<AppCustomRouteRecordRaw[]>> => {
|
|
return request.get({ url: '/admin/auth/menus', params })
|
|
}
|
|
|
|
export const getTestRoleApi = (params: RoleParams): Promise<IResponse<string[]>> => {
|
|
return request.get({ url: '/mock/role/list2', params })
|
|
}
|
|
|
|
/** 自助改密(首登强制改密也走这个接口) */
|
|
export const changePasswordApi = (data: { oldPassword: string; newPassword: string }) => {
|
|
return request.post<void>({ url: '/admin/auth/password', data })
|
|
}
|