pinia-orm icon indicating copy to clipboard operation
pinia-orm copied to clipboard

Ambiguous documentation about deleting in new axios plugin

Open vesper8 opened this issue 2 years ago • 1 comments
trafficstars

Environment

No response

Reproduction


Describe the bug

In these docs: https://pinia-orm.codedredd.de/plugins/axios/guide/usage#delete-requests

You have this code snippet

useAxiosRepo(User).api().delete('/api/users/1', {
  delete: 1
})

It's unclear whether the value required by the delete parameter must be the id of the User you want to delete, or whether the 1 is actually a boolean true. Since in the example above both the api endpoint and the value below are both 1

I tried deleting something without adding the delete parameter and I got an error about a missing primary key.

I then added the id I wanted deleted, and this time I got no error, but it also did not delete the record I wanted to delete.

Finally I changed it to 1 (Even though the record I want to delete is not 1, and then inside the .then statement I used useRepo to delete the record myself.

This is working well but.. unsure if this is the way.. seems something is not working here.

Furthermore, the documentation says to refer to See also: [Configurations - delete](https://pinia-orm.codedredd.de/plugins/axios/guide/configurations#delete) for more info, but this link (https://pinia-orm.codedredd.de/plugins/axios/guide/configurations#delete) leads to a 404

Additional context

No response

Logs

No response

vesper8 avatar Sep 21 '23 13:09 vesper8

@CodeDredd Would appreciate a reply to this, I'm still struggling to understand how we can delete a record in one single operation by using useAxiosRepo. Currently it seems like that isn't possible.

vesper8 avatar Jan 30 '24 14:01 vesper8