功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Front-end API wrapper for this module.
|
||||
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
||||
*/
|
||||
import { adminApi } from './admin'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
@@ -25,7 +29,16 @@ export interface UpdatePermissionRequest {
|
||||
description?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* permissionApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
*/
|
||||
export const permissionApi = {
|
||||
/**
|
||||
* `getUserPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userId?: IdType caller-supplied value for `userId?: IdType`
|
||||
*/
|
||||
getUserPermissions: (userId?: IdType) => {
|
||||
if (userId) {
|
||||
return adminApi.get<PermissionVO[]>(`/permission/user/${userId}`)
|
||||
@@ -33,26 +46,57 @@ export const permissionApi = {
|
||||
return adminApi.get<PermissionVO[]>('/permission/user/current')
|
||||
},
|
||||
|
||||
/**
|
||||
* `getAssignablePermissionIds` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userId: IdType caller-supplied value for `userId: IdType`
|
||||
*/
|
||||
getAssignablePermissionIds: (userId: IdType) => {
|
||||
return adminApi.get<IdType[]>(`/permission/assignable/${userId}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* `listAllPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
listAllPermissions: () => {
|
||||
return adminApi.get<PermissionVO[]>('/permission/list/all')
|
||||
},
|
||||
|
||||
/**
|
||||
* `createPermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: CreatePermissionRequest caller-supplied value for `data: CreatePermissionRequest`
|
||||
*/
|
||||
createPermission: (data: CreatePermissionRequest) => {
|
||||
return adminApi.post('/permission/create', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `updatePermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
* @param data: UpdatePermissionRequest caller-supplied value for `data: UpdatePermissionRequest`
|
||||
*/
|
||||
updatePermission: (id: IdType, data: UpdatePermissionRequest) => {
|
||||
return adminApi.put(`/permission/update/${id}`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* `deletePermission` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param id: IdType caller-supplied value for `id: IdType`
|
||||
*/
|
||||
deletePermission: (id: IdType) => {
|
||||
return adminApi.delete(`/permission/delete/${id}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* `assignUserPermissions` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param userId: IdType caller-supplied value for `userId: IdType`
|
||||
* @param permissionIds: IdType[] caller-supplied value for `permissionIds: IdType[]`
|
||||
*/
|
||||
assignUserPermissions: (userId: IdType, permissionIds: IdType[]) => {
|
||||
return adminApi.post(`/permission/assign/${userId}`, { permissionIds })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user