@@ -61,7 +61,7 @@ const addCamelizeInterceptor = (instance) => {
|
||||
)
|
||||
}
|
||||
|
||||
const addUnauthorizeInterceptor = (instance) => {
|
||||
const _addUnauthorizeInterceptor = (instance) => {
|
||||
instance.interceptors.response.use(
|
||||
(res) => res,
|
||||
async (e) => {
|
||||
@@ -89,7 +89,7 @@ const createInstance = (baseUrl, { headers = {}, ...configs } = {}) => {
|
||||
addResponseUnwrapInterceptor(instance)
|
||||
addCamelizeInterceptor(instance)
|
||||
addSnakizeInterceptor(instance)
|
||||
// addUnauthorizeInterceptor(instance)
|
||||
// _addUnauthorizeInterceptor(instance)
|
||||
return instance
|
||||
}
|
||||
|
||||
|
||||
@@ -134,14 +134,12 @@ register('PATCH', endpoints.updateUserRole, ({ params, data }) => {
|
||||
const nextRoleNames = Array.isArray(data.roles)
|
||||
? data.roles.filter(Boolean)
|
||||
: data.role
|
||||
? [data.role]
|
||||
: data.roleId
|
||||
? [roles.find((r) => r.id === Number(data.roleId))?.name].filter(Boolean)
|
||||
: []
|
||||
? [data.role]
|
||||
: data.roleId
|
||||
? [roles.find((r) => r.id === Number(data.roleId))?.name].filter(Boolean)
|
||||
: []
|
||||
const primary = nextRoleNames[0] ? byName(nextRoleNames[0]) : null
|
||||
const patch = nextRoleNames.length
|
||||
? { roles: nextRoleNames, roleId: primary?.id }
|
||||
: {}
|
||||
const patch = nextRoleNames.length > 0 ? { roles: nextRoleNames, roleId: primary?.id } : {}
|
||||
const updated = updateById(adminUsers, params.id, patch)
|
||||
return {
|
||||
success: true,
|
||||
|
||||
@@ -80,5 +80,4 @@ export const useGetRegisterDataQuery = (options = {}) =>
|
||||
...options,
|
||||
})
|
||||
|
||||
export const useSaveRegisterDataMutation = () =>
|
||||
useMutation({ mutationFn: apiSaveRegisterData })
|
||||
export const useSaveRegisterDataMutation = () => useMutation({ mutationFn: apiSaveRegisterData })
|
||||
|
||||
Reference in New Issue
Block a user