mrichar1 / jsonapi-vuex

Use a JSONAPI api with a Vuex store, with data restructuring/normalization.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing option to deactivate url encoding in deleteRecord

msulland opened this issue · comments

Hi,

There is a missing encode true/false option in the deleteRecord method. This makes it impossible to delete objects with compound id's. Something like hello:world fails.

I tested by adding false to getTypeId:

deleteRecord: (state, record) => {
  const [type, id] = utils.getTypeId(record, false)
  if (!type || !id) {
    throw `deleteRecord: Missing type or id: ${record}`
  }

and it worked.

I haven't created a code fix since I'm unsure about how you would prefer this to be enabled (I did see that you have closed a previous issue about url-encoding)

I'm using vue 2.7.14 with
"jsonapi-vuex": "4.5.3",
"vuex": "3.6.0",

Regards,
Magnus

Hi - thanks for spotting this and flagging it up. You're quite right, it should have encoding=false set there.

I'll patch and push a new version for this, as it should probably also have a test added for compound ids - I will let you know when the new version is released.

That's this fixed with a new release - 5.11.0 - which has just been published. Let me know if this fixes things for you and I can close this issue. Thanks!