diff --git a/src/containers/Organization/UserList.jsx b/src/containers/Organization/UserList.jsx index 920752a1..e9ac9658 100644 --- a/src/containers/Organization/UserList.jsx +++ b/src/containers/Organization/UserList.jsx @@ -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"; @@ -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", @@ -29,6 +38,7 @@ const UserList = ({ data }) => { const selectedRow = tableData[rowIndex]; return ( + <> { + {selectedRow.has_accepted_invite === false && + + {handleReinvite(selectedRow.email)}}> + + + + } + ); }, }, diff --git a/src/redux/actions/api/User/ResendUserInvite.js b/src/redux/actions/api/User/ResendUserInvite.js new file mode 100644 index 00000000..21f6c61d --- /dev/null +++ b/src/redux/actions/api/User/ResendUserInvite.js @@ -0,0 +1,45 @@ + +import API from "../../../api"; +import ENDPOINTS from "../../../../config/apiendpoint"; + +export default class ResendUserInviteAPI extends API { + constructor(email, timeout = 2000) { + super("POST", timeout, false); + this.email = email; + this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.resetPassword}`; + this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.signup}regenerate/`; + } + + processResponse(res) { + super.processResponse(res); + if (res) { + this.resendinviteRes = res; + } + } + + apiEndPoint() { + return this.endpoint; + } + + getBody() { + return { + emails : this.email + } +} + + + getHeaders() { + this.headers = { + headers: { + "Content-Type": "application/json", + "Authorization":`JWT ${localStorage.getItem('token')}` + }, + }; + return this.headers; + } + + getPayload() { + return this.resendinviteRes; + } + } + \ No newline at end of file diff --git a/src/redux/actions/index.js b/src/redux/actions/index.js index a32a8429..052949fe 100644 --- a/src/redux/actions/index.js +++ b/src/redux/actions/index.js @@ -113,6 +113,7 @@ import CreateGlossaryAPI from "./api/User/CreateGlossary"; import UpdateTipsAPI from "./api/User/UpdateTips"; import DeleteGlossaryAPI from "./api/User/DeleteGlossary"; import UploadGlossaryAPI from "./api/User/UploadGlossary"; +import ResendUserInviteAPI from "./api/User/ResendUserInvite"; //Commom Actions import { @@ -303,5 +304,6 @@ export { CreateMemberAPI, UpdateOnboardingFormAPI, FetchOnboardingListAPI, - UpdateAndReplaceWordsAPI + UpdateAndReplaceWordsAPI, + ResendUserInviteAPI, };