Skip to content

Commit

Permalink
changes for reinvite user
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar committed Jul 30, 2024
1 parent ad0755b commit 4b6b8c4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/containers/UserManagement/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
setSnackBar,
UpdateUserRoleAPI,
FetchUserRolesAPI,
ResendUserInviteAPI,
} from "redux/actions";

const EditProfile = () => {
Expand Down Expand Up @@ -217,6 +218,12 @@ 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 @@ -452,8 +459,20 @@ 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
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 4b6b8c4

Please sign in to comment.