diff --git a/apps/operator/pages/tenants/[slug].vue b/apps/operator/pages/tenants/[slug].vue index a35c35d..2ff3dd3 100644 --- a/apps/operator/pages/tenants/[slug].vue +++ b/apps/operator/pages/tenants/[slug].vue @@ -85,6 +85,25 @@ type IntegrationKey = (typeof INTEGRATIONS)[number] // runs; reusable whenever the first invite failed or someone new takes over. const inviteAdminOpen = ref(false) +// Platform-tenant flag toggle. Single holder — the API clears it from every +// other tenant when set. Grants exactly one thing: claiming the dezky.eu +// apex as this tenant's customer mail domain. +const flagBusy = ref(false) +const flagError = ref(null) +async function setPlatformTenant(value: boolean) { + flagBusy.value = true + flagError.value = null + try { + await $fetch(`/api/tenants/${slug.value}`, { method: 'PATCH', body: { isPlatformTenant: value } }) + await refreshTenant() + } catch (err: unknown) { + const e = err as { data?: { data?: { message?: string }; message?: string } } + flagError.value = e.data?.data?.message ?? e.data?.message ?? String(err) + } finally { + flagBusy.value = false + } +} + // ── Danger-zone state ───────────────────────────────────────────────────── const dangerAction = ref<'suspend' | 'resume' | 'delete' | 'purge' | null>(null) const dangerBusy = ref(false) @@ -145,6 +164,7 @@ async function reconcile() {