Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

679 B
Raw Blame
import { authClient } from "@/lib/auth-client";

export type GetWorkspaceUsersRequest = {
  workspaceId: string;
  limit?: number;
  offset?: number;
  sortBy?: string;
  sortDirection?: "asc" | "desc";
};

async function getWorkspaceUsers({
  workspaceId,
  limit,
  offset,
  sortBy,
  sortDirection,
}: GetWorkspaceUsersRequest) {
  const { data, error } = await authClient.organization.listMembers({
    query: {
      organizationId: workspaceId,
      limit,
      offset,
      sortBy,
      sortDirection,
    },
  });

  if (error) {
    throw new Error(error.message || "Failed to fetch workspace users");
  }

  return data || [];
}

export default getWorkspaceUsers;