diff --git a/packages/frontend-2/pages/settings/workspaces/[slug]/security.vue b/packages/frontend-2/pages/settings/workspaces/[slug]/security.vue
index ef3fa1242..31372e988 100644
--- a/packages/frontend-2/pages/settings/workspaces/[slug]/security.vue
+++ b/packages/frontend-2/pages/settings/workspaces/[slug]/security.vue
@@ -26,11 +26,7 @@
class="border-x border-b first:border-t first:rounded-t-lg border-outline-2 last:rounded-b-lg p-6 py-4 flex items-center"
>
@{{ domain.domain }}
-
+
Delete
@@ -434,4 +430,37 @@ const handleJoinPolicyConfirm = async () => {
})
}
}
+
+watch(
+ () => workspaceDomains.value.length,
+ async (newLength) => {
+ // If last domain was removed, disable all domain features
+ if (newLength === 0 && workspace.value?.id) {
+ if (workspace.value.discoverabilityEnabled) {
+ await updateDiscoverability({
+ input: {
+ id: workspace.value.id,
+ discoverabilityEnabled: false
+ }
+ })
+ }
+ if (workspace.value.discoverabilityAutoJoinEnabled) {
+ await updateAutoJoin({
+ input: {
+ id: workspace.value.id,
+ discoverabilityAutoJoinEnabled: false
+ }
+ })
+ }
+ if (workspace.value.domainBasedMembershipProtectionEnabled) {
+ await updateDomainProtection({
+ input: {
+ id: workspace.value.id,
+ domainBasedMembershipProtectionEnabled: false
+ }
+ })
+ }
+ }
+ }
+)