Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1365

Merged
merged 2 commits into from
Sep 6, 2024
Merged

fix #1365

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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