Skip to content

Commit

Permalink
Merge branch 'develop2' into reports4
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar authored Aug 2, 2024
2 parents f6709b9 + b0f8d87 commit cfbbefb
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 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
45 changes: 45 additions & 0 deletions src/redux/actions/api/User/ResendUserInvite.js
Original file line number Diff line number Diff line change
@@ -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;
}
}

4 changes: 3 additions & 1 deletion src/redux/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -303,5 +304,6 @@ export {
CreateMemberAPI,
UpdateOnboardingFormAPI,
FetchOnboardingListAPI,
UpdateAndReplaceWordsAPI
UpdateAndReplaceWordsAPI,
ResendUserInviteAPI,
};

0 comments on commit cfbbefb

Please sign in to comment.