Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dynamic resource endpoint #1346

Open
redet-G opened this issue Apr 15, 2023 · 0 comments
Open

Support for dynamic resource endpoint #1346

redet-G opened this issue Apr 15, 2023 · 0 comments

Comments

@redet-G
Copy link

redet-G commented Apr 15, 2023

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"
    ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant