Skip to content

Commit 9906ddb

Browse files
committed
fwf-6190:integrated role api
1 parent 43efbb0 commit 9906ddb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

forms-flow-nav/src/endpoints/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const API = {
88
USER_PROFILE_UPDATE: `${WEB_BASE_URL}/user/<user_id>/profile`,
99
GET_PERMISSIONS: `${WEB_BASE_URL}/roles/permissions`,
1010
USER_LOGIN_DETAILS: (userId) => `${WEB_BASE_URL}/user/${userId}/login-details`,
11+
ONBOARDING_USER_ROLE: `${WEB_BASE_URL}/user/info`,
1112
}
1213

1314
export default API;

forms-flow-nav/src/services/user/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,20 @@ export const fetchUserLoginDetails = () => {
3030
console.error(error);
3131
});
3232
};
33-
33+
export const getOnBoardingUserRole = () => {
34+
const url = API.USER_INFO_UPDATE;
35+
return RequestService.httpGETRequest(url)
36+
.then((res)=>{
37+
if(res.data){
38+
localStorage.setItem("ONBOARDINGUSERROLE", res.data.role);
39+
}
40+
}).catch((err)=>{
41+
// the api is not ready yet, so we are setting the default role to operations
42+
// will replace with actual catch block once the api is ready
43+
localStorage.setItem("ONBOARDINGUSERROLE", "finance");
44+
console.error("getOnBoardingUserRole error:", err);
45+
});
46+
};
3447

3548
/**
3649
* Trigger a reset password email/link for the current user.

forms-flow-nav/src/sidenav/Sidebar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { fetchTenantDetails, handleTenantSubscription } from "../services/tenant
2222
import { setShowApplications } from "../constants/userContants";
2323
import { LANGUAGE } from "../constants/constants";
2424
import { checkIntegrationEnabled } from "../services/integration";
25-
import { fetchUserLoginDetails } from "../services/user";
25+
import { fetchUserLoginDetails,getOnBoardingUserRole } from "../services/user";
2626
import MenuComponent from "./MenuComponent";
2727
// import Appname from "./formsflow.svg";
2828
import { ApplicationLogo, LogoutIcon, MenuToggleIcon } from "@formsflow/components";
@@ -251,7 +251,7 @@ const Sidebar = React.memo(({ props, sidenavHeight="100%" }) => {
251251
if (isAuthenticated) {
252252
// Fetch federated login details (saves into localStorage)]
253253
fetchUserLoginDetails();
254-
254+
getOnBoardingUserRole();
255255
checkIntegrationEnabled()
256256
.then((res) => {
257257
setIntegrationEnabled(res.data?.enabled);

0 commit comments

Comments
 (0)