Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

715 B
Raw Blame
import type { RoleListRequest } from '@/models/access-control'
import { useInfiniteQuery } from '@tanstack/react-query'
import { useMemo } from 'react'
import { workspaceRoleListInfiniteOptions } from '../workspace-role-list-query'
import { formatRoleGroups } from './helpers'

export const useRoleGroups = (params: RoleListRequest) => {
  const {
    data: roleList,
    isFetchingNextPage,
    isLoading,
    fetchNextPage,
    hasNextPage,
    error,
  } = useInfiniteQuery(workspaceRoleListInfiniteOptions(params))

  const roleGroups = useMemo(() => formatRoleGroups(roleList), [roleList])

  return {
    roleGroups,
    isFetchingNextPage,
    isLoading,
    fetchNextPage,
    hasNextPage,
    error,
  }
}