Skip to content

Commit

Permalink
fix(user management): prevent admins from proceeding further without …
Browse files Browse the repository at this point in the history
…user#1270)

#1267
  • Loading branch information
ss-nikunj authored Nov 13, 2024
1 parent 662c893 commit cb10580
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/overlays/AddAppUserRoles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import {
type UserRoleRequest,
SuccessErrorType,
} from 'features/admin/appuserApiSlice'
import { setRolesToAdd } from 'features/admin/userDeprecated/actions'
import {
setRolesToAdd,
setSelectedUserToAdd,
} from 'features/admin/userDeprecated/actions'
import { Box } from '@mui/material'
import { useState } from 'react'

Expand All @@ -71,6 +74,7 @@ export default function AddAppUserRoles() {
try {
await updateUserRoles(data).unwrap()
dispatch(setUserRoleResp(SuccessErrorType.SUCCESS))
clearUsersAndRoles()
} catch (err) {
dispatch(setUserRoleResp(SuccessErrorType.ERROR))
}
Expand All @@ -80,7 +84,12 @@ export default function AddAppUserRoles() {

const handleCancel = () => {
dispatch(show(OVERLAYS.NONE, ''))
clearUsersAndRoles()
}

const clearUsersAndRoles = () => {
dispatch(setRolesToAdd([]))
dispatch(setSelectedUserToAdd([]))
}

const AddStepsList = [
Expand Down

0 comments on commit cb10580

Please sign in to comment.