Skip to content

Commit

Permalink
fix (#1365)
Browse files Browse the repository at this point in the history
* fix

* Update Home.js

---------

Co-authored-by: nabeelmd-eGov <[email protected]>
  • Loading branch information
aaradhya-egov and nabeelmd-eGov authored Sep 6, 2024
1 parent d5dba8a commit fb46da8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ export const ULBService = {
// TODO: change when setter is done.

const user = UserService.getUser();
const isMultiRootTenant = window?.globalConfigs?.getConfig("MULTI_ROOT_TENANT") || false;
const pathname = window.location.pathname;
const context = window?.globalConfigs?.getConfig("CONTEXT_PATH");
const start = pathname.indexOf(context) + context.length + 1;
const employeeIndex = pathname.indexOf("employee");
const citizenIndex = pathname.indexOf("citizen");
const end = (employeeIndex !== -1) ? employeeIndex : (citizenIndex !== -1) ? citizenIndex : -1;
const tenant = end > start ? pathname.substring(start, end).replace(/\/$/, "") : "";
if (user?.extraRoleInfo) {
const isDsoRoute = Digit.Utils.detectDsoRoute(window.location.pathname);
if (isDsoRoute) {
Expand All @@ -47,8 +39,7 @@ export const ULBService = {
}

//TODO: fix tenant id from userinfo
const tenantId = user?.info?.type !== "EMPLOYEE" && isMultiRootTenant && tenant ? tenant :
user?.info?.type === "EMPLOYEE" && user?.info?.tenantId ? user?.info?.tenantId : window?.globalConfigs.getConfig("STATE_LEVEL_TENANT_ID");
const tenantId = user?.info?.type === "EMPLOYEE" && user?.info?.tenantId ? user?.info?.tenantId : window?.globalConfigs.getConfig("STATE_LEVEL_TENANT_ID");
return tenantId;
},
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const processLinkData = (newData, code, t) => {
const obj = newData?.[`${code}`];
if (obj) {
obj.map((link) => {
if (window.globalPath === "sandbox-ui") {
link["navigationURL"] = link["navigationURL"].replace("/sandbox-ui/citizen", `/sandbox-ui/${Digit.ULBService.getCurrentTenantId()}/citizen`);
if (Digit.Utils.getMultiRootTenant()) {
link["navigationURL"] = link["navigationURL"].replace("/sandbox-ui/citizen", `/sandbox-ui/${Digit.ULBService.getStateId()}/citizen`);
}
link.link = link["navigationURL"];
link.i18nKey = t(link["name"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const TopBar = ({
const [profilePic, setProfilePic] = React.useState(null);

React.useEffect(async () => {
const tenant = Digit.ULBService.getCurrentTenantId();

const tenant = Digit.Utils.getMultiRootTenant() ? Digit.ULBService.getStateId(): Digit.ULBService.getCurrentTenantId();
const uuid = userDetails?.info?.uuid;
if (uuid) {
const usersResponse = await Digit.UserService.userSearch(tenant, { uuid: [uuid] }, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (window?.globalPath === 'sandbox-ui') {
requestCriteria = {
url: "/tenant-management/tenant/_search",
params: {
code: Digit.ULBService.getCurrentTenantId(),
code: Digit.ULBService.getStateId(),
includeSubTenants: true
},
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (window.globalPath === 'sandbox-ui') {
requestCriteria = {
url: "/tenant-management/tenant/_search",
params: {
code: Digit.ULBService.getCurrentTenantId(),
code: Digit.ULBService.getStateId(),
includeSubTenants: true
},
body: {
Expand Down

0 comments on commit fb46da8

Please sign in to comment.