From 3d94926343a51d240ed5241c71cf5116bf9b8e1c Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 5 Sep 2024 15:19:45 +0100 Subject: [PATCH] feat: add custom domain to domain button --- apps/dashboard/src/lib/utils/store/org.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/dashboard/src/lib/utils/store/org.ts b/apps/dashboard/src/lib/utils/store/org.ts index 2719d369..0fc379b5 100644 --- a/apps/dashboard/src/lib/utils/store/org.ts +++ b/apps/dashboard/src/lib/utils/store/org.ts @@ -35,16 +35,20 @@ export const isOrgAdmin = derived(currentOrg, ($currentOrg) => $currentOrg.role_ export const currentOrgPlan = derived(currentOrg, ($currentOrg) => $currentOrg.organization_plan.find((p) => p.is_active) ); + export const currentOrgPath = derived(currentOrg, ($currentOrg) => $currentOrg.siteName ? `/org/${$currentOrg.siteName}` : '' ); + export const currentOrgDomain = derived(currentOrg, ($currentOrg) => { const browserOrigin = dev && browser && window.location.origin; return browserOrigin ? browserOrigin - : $currentOrg.siteName - ? `https://${$currentOrg.siteName}.classroomio.com` - : ''; + : $currentOrg.customDomain && $currentOrg.isCustomDomainVerified + ? `https://${$currentOrg.customDomain}` + : $currentOrg.siteName + ? `https://${$currentOrg.siteName}.classroomio.com` + : ''; }); // Utility org store