Skip to content

Commit

Permalink
Merge pull request #768 from AI4Bharat/reinvite
Browse files Browse the repository at this point in the history
changes for reinvite user
  • Loading branch information
aparna-aa authored Jul 30, 2024
2 parents 01bd378 + 616b92b commit 53dc4b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
20 changes: 19 additions & 1 deletion src/containers/Organization/UserList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { useSelector } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { getColumns, getOptions } from "utils";
import { usersColumns } from "config";
Expand All @@ -9,14 +9,23 @@ import { tableTheme } from "theme";

//Icons
import PreviewIcon from "@mui/icons-material/Preview";
import MailIcon from "@mui/icons-material/Mail";

//Components
import { ThemeProvider, Tooltip, IconButton } from "@mui/material";
import MUIDataTable from "mui-datatables";
import { APITransport, ResendUserInviteAPI } from "redux/actions";

const UserList = ({ data }) => {
const dispatch = useDispatch();
const apiStatus = useSelector((state) => state.apiStatus);

const handleReinvite = (email) => {
let apiObj;
apiObj = new ResendUserInviteAPI([email]);
dispatch(APITransport(apiObj));
};

const actionColumn = {
name: "Action",
label: "Actions",
Expand All @@ -29,6 +38,7 @@ const UserList = ({ data }) => {
const selectedRow = tableData[rowIndex];

return (
<>
<Link
to={`/profile/${selectedRow.id}`}
style={{ textDecoration: "none" }}
Expand All @@ -39,6 +49,14 @@ const UserList = ({ data }) => {
</IconButton>
</Tooltip>
</Link>
{selectedRow.has_accepted_invite === false &&
<Tooltip title="Reinvite">
<IconButton onClick={() => {handleReinvite(selectedRow.email)}}>
<MailIcon color="primary" />
</IconButton>
</Tooltip>
}
</>
);
},
},
Expand Down
19 changes: 0 additions & 19 deletions src/containers/UserManagement/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
setSnackBar,
UpdateUserRoleAPI,
FetchUserRolesAPI,
ResendUserInviteAPI,
} from "redux/actions";

const EditProfile = () => {
Expand Down Expand Up @@ -218,12 +217,6 @@ const EditProfile = () => {
);
};

const handleReinvite = () => {
let apiObj;
apiObj = new ResendUserInviteAPI([userData.email]);
dispatch(APITransport(apiObj));
};

const handleSubmit = () => {
let updateProfileReqBody = {
username: userDetails.username,
Expand Down Expand Up @@ -459,20 +452,8 @@ const EditProfile = () => {
direction="row"
justifyContent="flex-end"
alignItems="center"
gap={4}
sx={{ my: 5, px: "9.75%" }}
>
{userData.has_accepted_invite === false &&
<Button
variant="contained"
color="error"
onClick={() => handleReinvite()}
sx={{ borderRadius: "8px", width: "180px" }}
className={classes.editProfileBtn}
>
Reinvite
</Button>
}
<Button
variant="contained"
color="primary"
Expand Down

0 comments on commit 53dc4b4

Please sign in to comment.