Skip to content

implement getQueryOptions at openapi-react-query #2389

@barmaglot92

Description

@barmaglot92

Description

Hi, my architectural vision, as well as for example FSD, involves using entities and API slices, the implementation of which requires creating wrapper functions.

Proposal

I suggest implementing a getQueryOptions function that would return a function requiring init and options for the specified method and path.

/* ./entities/sequrity-object/api/query.ts */
export const getSequrityObjectOptions = $api.query.someservice.getQueryOptions('get', '/method');

const Component = () => {
  const { data, error, loading } = useQuery(
    getSequrityObjectOptions({ params: { testparam: 'test' } }, { enabled: true }),
  );
};

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions