2025-11-24 01:00:50 +01:00
|
|
|
import { env } from '$env/dynamic/private';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { getSubdomain } from '$features/app/layout-setup';
|
2025-11-24 01:00:50 +01:00
|
|
|
import { redirect } from '@sveltejs/kit';
|
|
|
|
|
|
|
|
|
|
const APP_SUBDOMAINS = env.PRIVATE_APP_SUBDOMAINS?.split(',') || ['app'];
|
|
|
|
|
|
|
|
|
|
export const load = async ({ params, url }) => {
|
|
|
|
|
const subdomain = getSubdomain(url);
|
|
|
|
|
const isOrgSite = subdomain && !APP_SUBDOMAINS.includes(subdomain);
|
|
|
|
|
// If this is LMS but user is on org site, redirect to LMS
|
|
|
|
|
if (isOrgSite) {
|
|
|
|
|
redirect(307, `/lms`);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-07 06:08:34 +01:00
|
|
|
return {
|
|
|
|
|
orgName: params.slug
|
|
|
|
|
};
|
|
|
|
|
};
|