Skip to content

Organization Switch Button Enabled but Not Working #272

@unijaychie

Description

@unijaychie

Severity: High

  1. Blocks core functionality for users with multiple organizations.
  2. Prevents access to critical data or workflows tied to other accounts.

Describe the bug
When a user attempts to switch between organizations (e.g., from unijaychie to jaychiex) on the Organization Settings page, the Switch button appears enabled but does not function. This prevents users from accessing their other organization.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to https://app.aixblock.io/user/account.
  2. Log in with an account that has multiple organizations (e.g., unijaychie and jaychiex).
  3. Select the Switch button for the jaychiex organization.
  4. Observe that the button is enabled but does not switch to the selected organization.

Expected behavior
Clicking the Switch button should activate the selected organization (e.g., jaychiex) and update the user’s active context.

Screenshots

Image
AIxBlock.-.Google.Chrome.2025-09-04.07-55-54.mp4

Desktop (please complete the following information):
OS: Windows 11
Browser Chrome
Version v139.0.7258.139

Additional context
Users cannot switch between organizations, requiring manual logout/login to access other accounts.

Suggested Fix
Frontend Fix:

Ensure the Switch button triggers the correct API call to update the active organization.
Example fix (JavaScript):

javascript

const handleSwitchOrganization = async (orgId) => {
  try {
    const response = await fetch('/api/switch-organization', {
      method: 'POST',
      body: JSON.stringify({ organizationId: orgId }),
    });
    if (response.ok) {
      // Update UI to reflect the new organization
      setOrganization(orgId);
    } else {
      alert("Failed to switch organization. Please try again.");
    }
  } catch (error) {
    console.error("Switch organization error:", error);
    alert("An unexpected error occurred.");
  }
};

Backend Fix (if applicable):

Ensure the /api/switch-organization endpoint correctly processes the request and updates the user’s active organization in the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions