You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But this will fail because the item types returned by my JSON API are actually credit-card and debit-card. As an ugly hack, I can call this function repeatedly for all the possible types until one resolves with the data.
Would it make sense to have a getter that does not require specifying a type since IDs should be unique across types in the database?
The text was updated successfully, but these errors were encountered:
I think the right way to go about handling records from the store with globally unique IDs is to use the jsonpath functionality provided in the get getter. Bear in mind that not all APIs have globally unique ids, and that ids muct only be unique for each type:
Within a given API, each resource object’s type and idpairMUST identify a single, unique resource.
You should be able to specify no type or id, which would normally return the whole store, and then filter by id - so to get all resources with id = 10 you'd do:
this.$store.getters['jv/get']('', '$.*.10')
As it turned out, this wasn't previously possible, since the code path for returning the whole store missed the jsonpath filtering code, but I've fixed this in 0.1.1
I have a need to look up an item by id which has a polymorphic type. For example:
But this will fail because the item types returned by my JSON API are actually
credit-card
anddebit-card
. As an ugly hack, I can call this function repeatedly for all the possible types until one resolves with the data.Would it make sense to have a getter that does not require specifying a type since IDs should be unique across types in the database?
The text was updated successfully, but these errors were encountered: