diff --git a/apps/web/src/components/OrgSwitcher.vue b/apps/web/src/components/OrgSwitcher.vue index db89ad2..08137b4 100644 --- a/apps/web/src/components/OrgSwitcher.vue +++ b/apps/web/src/components/OrgSwitcher.vue @@ -31,6 +31,8 @@ const currentName = computed( () => auth.user?.organizationName || orgs.value.find((o) => o.id === auth.user?.organizationId)?.name || 'محیط کاری', ); +const canSwitch = computed(() => orgs.value.length > 1); + function apiError(e: unknown, fallback: string) { if (axios.isAxiosError(e)) { const msg = (e.response?.data as { message?: string | string[] })?.message; @@ -48,6 +50,7 @@ async function loadOrgs() { } async function toggle() { + if (!canSwitch.value) return; error.value = ''; if (open.value) { open.value = false; @@ -134,12 +137,13 @@ onUnmounted(() => { diff --git a/apps/web/src/layouts/AppLayout.vue b/apps/web/src/layouts/AppLayout.vue index 964fbea..d37e92c 100644 --- a/apps/web/src/layouts/AppLayout.vue +++ b/apps/web/src/layouts/AppLayout.vue @@ -1,5 +1,5 @@ @@ -422,9 +379,9 @@ onUnmounted(() => {