Skip to content

Commit e851e1f

Browse files
Issue feat: Update pr remove service file changes
1 parent 19cfa09 commit e851e1f

File tree

1 file changed

+7
-37
lines changed

1 file changed

+7
-37
lines changed

apps/learner-web-app/src/utils/API/ProgramService.ts

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,10 @@ export const getTenantInfo = async (): Promise<any> => {
88
try {
99
const response = await axios.get(apiUrl);
1010
const currentOrigin = typeof window !== 'undefined' ? window.location.origin : '';
11-
const currentHostname = typeof window !== 'undefined' ? window.location.hostname : '';
12-
13-
// Check if we're on an ngrok domain
14-
const isNgrokDomain = currentHostname.includes('ngrok') || currentHostname.includes('ngrok.io') || currentHostname.includes('ngrok-free.app');
15-
16-
let matchingTenants = [];
17-
18-
if (isNgrokDomain) {
19-
// For ngrok domains, return all tenants as fallback
20-
matchingTenants = response?.data?.result || [];
21-
} else {
22-
// Normal domain matching
23-
matchingTenants =
24-
response?.data?.result?.filter((tenant: any) =>
25-
tenant?.params?.uiConfig?.enable_domain?.includes(currentOrigin)
26-
) || [];
27-
}
28-
11+
const matchingTenants =
12+
response?.data?.result?.filter((tenant: any) =>
13+
tenant?.params?.uiConfig?.enable_domain?.includes(currentOrigin)
14+
) || [];
2915
const programsData =
3016
matchingTenants.flatMap((t: any) => t?.children || []) || [];
3117
console.log("programsData", programsData)
@@ -55,26 +41,10 @@ export const getPrathamTenantId = async (): Promise<string | null> => {
5541
try {
5642
const response = await axios.get(apiUrl);
5743
const currentOrigin = typeof window !== 'undefined' ? window.location.origin : '';
58-
const currentHostname = typeof window !== 'undefined' ? window.location.hostname : '';
59-
60-
// Check if we're on an ngrok domain
61-
const isNgrokDomain = currentHostname.includes('ngrok') || currentHostname.includes('ngrok.io') || currentHostname.includes('ngrok-free.app');
62-
63-
let matchingTenants = [];
64-
65-
if (isNgrokDomain) {
66-
// For ngrok domains, find Pratham tenant by name as fallback
67-
matchingTenants = response?.data?.result?.filter((tenant: any) =>
68-
tenant?.name === 'Pratham'
44+
const matchingTenants =
45+
response?.data?.result?.filter((tenant: any) =>
46+
tenant?.params?.uiConfig?.enable_domain?.includes(currentOrigin)
6947
) || [];
70-
} else {
71-
// Normal domain matching
72-
matchingTenants =
73-
response?.data?.result?.filter((tenant: any) =>
74-
tenant?.params?.uiConfig?.enable_domain?.includes(currentOrigin)
75-
) || [];
76-
}
77-
7848
return matchingTenants[0]?.tenantId || null;
7949
} catch (error) {
8050
console.error('Error in fetching tenant info', error);

0 commit comments

Comments
 (0)