Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Update roles in 'Create User if a new role is added" #195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/pages/AccessManagement/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Roles: FC = () => {
};
}, []);

let rows =
const rows =
getRolesIsSuccess && getRolesData?.data ? (
getRolesData?.data.map((role: any) => {
return (
Expand Down Expand Up @@ -108,7 +108,7 @@ const Roles: FC = () => {
};

const handleCreateRole = () => {
let userRole: any = [];
const userRole: any = [];
if (selectedPrivilege === 'admin' || selectedPrivilege === 'editor') {
userRole?.push({
privilege: selectedPrivilege,
Expand All @@ -135,6 +135,7 @@ const Roles: FC = () => {
}
}
updateRoleMutation({ userName: createRoleInput, privilege: userRole });
getRolesRefetch();
handleClose();
};

Expand Down Expand Up @@ -258,7 +259,7 @@ const Roles: FC = () => {
</Button>
</Group>
</Modal>
<Modal opened={modalOpen} onClose={handleClose} title="Create user" centered className={classes.modalStyle}>
<Modal opened={modalOpen} onClose={handleClose} title="Create Role" centered className={classes.modalStyle}>
<Stack>
<TextInput
type="text"
Expand Down
6 changes: 3 additions & 3 deletions src/pages/AccessManagement/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Users: FC = () => {

const { getRolesData } = useRole();

let rows =
const rows =
getUserIsSuccess && getUserData?.data ? (
getUserData?.data.map((user: any) => {
return (
Expand Down Expand Up @@ -88,7 +88,7 @@ const Users: FC = () => {
};

const handleCreateUser = () => {
let userRole: any = [];
const userRole: any = [];
if (SelectedRole !== '') {
userRole.push(SelectedRole);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ const Users: FC = () => {
color="gray"
className={classes.modalActionBtn}
onClick={handleCreateUser}
disabled={createVaildtion()}>
disabled={createVaildtion() || !!createUserData?.data}>
Create
</Button>
<Button onClick={handleClose} variant="outline" color="gray" className={classes.modalCancelBtn}>
Expand Down
Loading