fix: 按swagger对齐用户权限接口
This commit is contained in:
@@ -47,7 +47,7 @@ export function fetchGetMenu() {
|
|||||||
*/
|
*/
|
||||||
export function fetchGetUserPermissions(userId: string) {
|
export function fetchGetUserPermissions(userId: string) {
|
||||||
return request.get<Api.Auth.UserPermissionsResponse>({
|
return request.get<Api.Auth.UserPermissionsResponse>({
|
||||||
url: `/api/admin/v1/auth/permissions/${userId}`
|
url: `/api/admin/v1/users/${userId}/permissions`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ export const useUserStore = defineStore(
|
|||||||
if (!info.value.userId) return []
|
if (!info.value.userId) return []
|
||||||
try {
|
try {
|
||||||
const res = await fetchGetUserPermissions(String(info.value.userId))
|
const res = await fetchGetUserPermissions(String(info.value.userId))
|
||||||
permissions.value = res.permissions
|
permissions.value = res
|
||||||
return res.permissions
|
return res
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取用户权限失败:', error)
|
console.error('获取用户权限失败:', error)
|
||||||
return []
|
return []
|
||||||
|
|||||||
11
src/types/api/auth.d.ts
vendored
11
src/types/api/auth.d.ts
vendored
@@ -63,16 +63,7 @@ declare namespace Api {
|
|||||||
type MenuListResponse = MenuNode[]
|
type MenuListResponse = MenuNode[]
|
||||||
|
|
||||||
/** 用户权限响应 */
|
/** 用户权限响应 */
|
||||||
interface UserPermissionsResponse {
|
type UserPermissionsResponse = string[]
|
||||||
userId: string
|
|
||||||
tenantId: string
|
|
||||||
merchantId: string
|
|
||||||
account: string
|
|
||||||
displayName: string
|
|
||||||
roles: string[]
|
|
||||||
permissions: string[]
|
|
||||||
createdAt: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 通过重置链接令牌重置管理员密码请求 */
|
/** 通过重置链接令牌重置管理员密码请求 */
|
||||||
interface ResetAdminPasswordRequest {
|
interface ResetAdminPasswordRequest {
|
||||||
|
|||||||
Reference in New Issue
Block a user