Libraries
    Preparing search index...
    • Builds a query key array for a specific endpoint call.

      Parameters

      • group: string

        The API group name (e.g. 'todos').

      • endpoint: string

        The endpoint name within the group (e.g. 'list').

      • Optionalargs: unknown

        Optional request arguments (params, query, body, headers). Included in the key when provided so that different argument combinations produce distinct cache entries.

      Returns readonly unknown[]

      A readonly query key array suitable for TanStack Query.

      buildQueryKey('todos', 'list');
      // ['@cleverbrush', 'todos', 'list']

      buildQueryKey('todos', 'list', { query: { page: 2 } });
      // ['@cleverbrush', 'todos', 'list', { query: { page: 2 } }]

      buildQueryKey('todos', 'get', { params: { id: 42 } });
      // ['@cleverbrush', 'todos', 'get', { params: { id: 42 } }]