teleporthq / teleport-code-generators

A collection of code generators for modern JavaScript applications
https://teleporthq.io
MIT License
1k stars 159 forks source link

(feat): Allow to send prop and state values to resource fetchers #841

Closed JayaKrishnaNamburu closed 1 year ago

JayaKrishnaNamburu commented 1 year ago

@TudorCe this will have a little impact on the #840. So, let's discuss once before merging 👍

This PR will allow passing state and prop values to the cms-list and cms-item

"resource": {
  "id": "7b9c1f5d-6012-4953-8041-c869482735f1",
  "params": {
    "skip": {
      "type": "expr",
      "content": "(parseInt(router.query?.['cPage-el1ez7'] ?? 1) - 1) * 2"
    },
    "author": {
      "type": "dynamic",
      "content": {
        "referenceType": "state",
        "id": "author_state"
      }
    },
    "author_prop": {
      "type": "dynamic",
      "content": {
        "referenceType": "prop",
        "id": "author_prop"
      }
    }
  }
TudorCe commented 1 year ago

Looks good, but we'll likely discuss about it tomorrow