Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Added filter for tenants
Browse files Browse the repository at this point in the history
  • Loading branch information
rakesh-wt-egov committed Sep 1, 2023
1 parent 9d45235 commit 5d6f867
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const StoreService = {
},
digitInitData: async (stateCode, enabledModules) => {
const { MdmsRes } = await MdmsService.init(stateCode);
const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0]||{};
const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0]||{};
const stateInfo = MdmsRes["common-masters"]?.StateInfo?.[0] || {};
const uiHomePage = MdmsRes["common-masters"]?.uiHomePage?.[0] || {};
const localities = {};
const revenue_localities = {};
const initData = {
Expand All @@ -71,11 +71,12 @@ export const StoreService = {
bannerUrl: stateInfo.bannerUrl,
},
localizationModules: stateInfo.localizationModules,
modules: MdmsRes?.tenant?.citymodule.filter((module) => module?.active).filter((module) => enabledModules?.includes(module?.code))?.sort((x,y)=>x?.order-y?.order),
uiHomePage: uiHomePage
modules: MdmsRes?.tenant?.citymodule
.filter((module) => module?.active)
.filter((module) => enabledModules?.includes(module?.code))
?.sort((x, y) => x?.order - y?.order),
uiHomePage: uiHomePage,
};


initData.selectedLanguage = Digit.SessionStorage.get("locale") || initData.languages[0].value;

ApiCacheService.saveSetting(MdmsRes["DIGIT-UI"]?.ApiCachingSettings);
Expand All @@ -85,15 +86,13 @@ export const StoreService = {
.flat()
.reduce((unique, ele) => (unique.find((item) => item.code === ele.code) ? unique : [...unique, ele]), []);
initData.tenants = MdmsRes?.tenant?.tenants
.map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
// .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code))
// .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
?.filter((x) => x.pgrEnabled)
.map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));
// .filter((item) => !!moduleTenants.find((mt) => mt.code === item.code))
// .map((tenant) => ({ i18nKey: `TENANT_TENANTS_${tenant.code.replace(".", "_").toUpperCase()}`, ...tenant }));

await LocalizationService.getLocale({
modules: [
`rainmaker-common`,
`rainmaker-${stateCode.toLowerCase()}`,
],
modules: [`rainmaker-common`, `rainmaker-${stateCode.toLowerCase()}`],
locale: initData.selectedLanguage,
tenantId: stateCode,
});
Expand All @@ -107,7 +106,10 @@ export const StoreService = {
},
defaultData: async (stateCode, moduleCode, language) => {
let moduleCodes = [];
if(typeof moduleCode !== "string") moduleCode.forEach(code => { moduleCodes.push(`rainmaker-${code.toLowerCase()}`) });
if (typeof moduleCode !== "string")
moduleCode.forEach((code) => {
moduleCodes.push(`rainmaker-${code.toLowerCase()}`);
});
const LocalePromise = LocalizationService.getLocale({
modules: typeof moduleCode == "string" ? [`rainmaker-${moduleCode.toLowerCase()}`] : moduleCodes,
locale: language,
Expand Down

0 comments on commit 5d6f867

Please sign in to comment.