File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff 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
1314export default API ;
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import { fetchTenantDetails, handleTenantSubscription } from "../services/tenant
2222import { setShowApplications } from "../constants/userContants" ;
2323import { LANGUAGE } from "../constants/constants" ;
2424import { checkIntegrationEnabled } from "../services/integration" ;
25- import { fetchUserLoginDetails } from "../services/user" ;
25+ import { fetchUserLoginDetails , getOnBoardingUserRole } from "../services/user" ;
2626import MenuComponent from "./MenuComponent" ;
2727// import Appname from "./formsflow.svg";
2828import { 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 ) ;
You can’t perform that action at this time.
0 commit comments