@@ -27,7 +27,7 @@ import { SortableKeys as PermissionGroupListSortableKeys } from './PermissionGro
27
27
// User Permissions
28
28
export const getUserById = async ( userId : User [ 'id' ] ) : Promise < User > => {
29
29
try {
30
- const { result } = ( await get ( `user /${ userId } ` ) ) as ResponseType < UserDto >
30
+ const { result } = ( await get ( `${ Routes . USER } /${ userId } ` ) ) as ResponseType < UserDto >
31
31
32
32
return transformUserResponse ( result )
33
33
} catch ( error ) {
@@ -41,10 +41,10 @@ export const createOrUpdateUser = (data: UserCreateOrUpdatePayload) => {
41
41
const options : APIOptions = {
42
42
timeout : window . _env_ . CONFIGURABLE_TIMEOUT ? parseInt ( window . _env_ . CONFIGURABLE_TIMEOUT , 10 ) : null ,
43
43
}
44
- return isUpdate ? put ( 'user' , data , options ) : post ( 'user' , data , options )
44
+ return isUpdate ? put ( Routes . USER , data , options ) : post ( Routes . USER , data , options )
45
45
}
46
46
47
- export const deleteUser = ( userId : User [ 'id' ] ) => trash ( `user /${ userId } ` )
47
+ export const deleteUser = ( userId : User [ 'id' ] ) => trash ( `${ Routes . USER } /${ userId } ` )
48
48
49
49
export const getUserList = async (
50
50
queryParams : BaseFilterQueryParams < UserListSortableKeys > ,
@@ -56,7 +56,7 @@ export const getUserList = async (
56
56
try {
57
57
const {
58
58
result : { users, totalCount } ,
59
- } = ( await get ( getUrlWithSearchParams ( 'user' , queryParams ?? { } ) , { signal } ) ) as ResponseType < {
59
+ } = ( await get ( getUrlWithSearchParams ( Routes . USER , queryParams ?? { } ) , { signal } ) ) as ResponseType < {
60
60
users : UserDto [ ]
61
61
totalCount : number
62
62
} >
@@ -76,7 +76,7 @@ export const getUserList = async (
76
76
// Permission Groups
77
77
export const getPermissionGroupById = async ( groupId : PermissionGroup [ 'id' ] ) : Promise < PermissionGroup > => {
78
78
try {
79
- const { result } = ( await get ( `user/role/group /${ groupId } ` ) ) as ResponseType < PermissionGroupDto >
79
+ const { result } = ( await get ( `${ Routes . USER_ROLE_GROUP } /${ groupId } ` ) ) as ResponseType < PermissionGroupDto >
80
80
return result
81
81
} catch ( error ) {
82
82
showError ( error )
@@ -90,7 +90,7 @@ export const createOrUpdatePermissionGroup = (payload: PermissionGroupCreateOrUp
90
90
timeout : window . _env_ . CONFIGURABLE_TIMEOUT ? parseInt ( window . _env_ . CONFIGURABLE_TIMEOUT , 10 ) : null ,
91
91
}
92
92
93
- return isUpdate ? put ( Routes . USER_ROLE_GROUP , payload , options ) : post ( 'user/role/group' , payload , options )
93
+ return isUpdate ? put ( Routes . USER_ROLE_GROUP , payload , options ) : post ( Routes . USER_ROLE_GROUP , payload , options )
94
94
}
95
95
96
96
export const getPermissionGroupList = async (
@@ -103,7 +103,7 @@ export const getPermissionGroupList = async (
103
103
try {
104
104
const {
105
105
result : { roleGroups : permissionGroups , totalCount } ,
106
- } = ( await get ( getUrlWithSearchParams ( 'user/role/group' , queryParams ?? { } ) , { signal } ) ) as ResponseType < {
106
+ } = ( await get ( getUrlWithSearchParams ( Routes . USER_ROLE_GROUP , queryParams ?? { } ) , { signal } ) ) as ResponseType < {
107
107
roleGroups : PermissionGroupDto [ ]
108
108
totalCount : number
109
109
} >
@@ -120,7 +120,7 @@ export const getPermissionGroupList = async (
120
120
}
121
121
}
122
122
123
- export const deletePermissionGroup = ( id : PermissionGroup [ 'id' ] ) => trash ( `user/role/group /${ id } ` )
123
+ export const deletePermissionGroup = ( id : PermissionGroup [ 'id' ] ) => trash ( `${ Routes . USER_ROLE_GROUP } /${ id } ` )
124
124
125
125
// Others
126
126
export const getCustomRoles = async ( ) : Promise < ResponseType < CustomRoles [ ] > > => {
0 commit comments