feat: support custom domain (#462)

* feat: add custom domain CRUD

* chore: fetch organization in layout in server before render

* debugging

* update log
This commit is contained in:
Rotimi Best
2024-09-04 06:32:54 +01:00
committed by GitHub
parent d1b38ca61e
commit 12d7a1ac3c
25 changed files with 915 additions and 221 deletions
+12 -4
View File
@@ -70,11 +70,19 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
const isDev = dev || isLocalHost;
if (!url.host.includes('.classroomio.com') && !isLocalHost) {
// TODO: We can verify if custom domain here
return response;
}
// Custom domain
response.org = (await getCurrentOrg(url.host, true, true)) || null;
if (!blockedSubdomain.includes(subdomain)) {
console.log('custom domain response.org', response.org);
if (!response.org) {
throw redirect(307, 'https://app.classroomio.com/404?type=org');
}
response.isOrgSite = true;
response.orgSiteName = response.org?.siteName || '';
return response;
} else if (!blockedSubdomain.includes(subdomain)) {
const answer = !!subdomain;
response.isOrgSite = debugMode || answer;