chore: debug getSubdomain

This commit is contained in:
Rotimi Best
2025-11-08 05:22:38 +01:00
parent 291e233700
commit 7715834566
+5 -3
View File
@@ -100,11 +100,9 @@ export const load = async ({ url, cookies, request }): Promise<LoadOutput> => {
return response; return response;
} }
const answer = !!subdomain;
console.log('subdomain', subdomain); console.log('subdomain', subdomain);
response.isOrgSite = debugMode || answer; response.isOrgSite = debugMode || !!subdomain;
response.orgSiteName = debugMode ? _orgSiteName : subdomain; response.orgSiteName = debugMode ? _orgSiteName : subdomain;
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null; response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
@@ -174,10 +172,14 @@ function getBaseMetaTags(url: URL) {
} }
function getSubdomain(url: URL) { function getSubdomain(url: URL) {
console.log('url.host', url);
const host = url.host.replace('www.', ''); const host = url.host.replace('www.', '');
console.log('host', host);
const parts = host?.split('.'); const parts = host?.split('.');
console.log('parts', parts);
if (host?.endsWith(env.PRIVATE_APP_HOST)) { if (host?.endsWith(env.PRIVATE_APP_HOST)) {
console.log('is app host');
return parts?.length >= 3 ? parts[0] : null; return parts?.length >= 3 ? parts[0] : null;
} }