Skip to content

Support for dynamic resource endpoint #1346

@redet-G

Description

@redet-G

Whenever we want to query a nested graph. We may want to insert dynamic properties inside the resource.

const validOrgUnitsQuery = {
  orgUnits: ({ dataSetId, orgUnit }) => ( {{
    resource: `dataSets/${dataSetId}/organisationUnits/gist`,
    params: {
      fields: ["id"],
      filter: `path:like:${orgUnit}`,
      total: true,
    },
  }),
};

and later I may want to do

const { loading, error, data, refetch } = useDataQuery(
    validOrgUnitsQuery,
    { variables: { dataSetId: selectedDataSet?.id, orgUnit: selectedOrgUnit?.id  })

Currently, it is not supported getting the following error object

{
    "type": "invalid-query",
    "details": [
        "[orgUnits] Property resource must be a string"
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions