Collection: Custom Data Parameter
- Dominant language
- TypeScript
- Stars
- 449
- Forks
- 21
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 2
Description
### Clear and concise description of the problem
For some of my endpoints I require that the user sends their password to confirm the action (like account deletion).
I'm not sure if there's a good solution currently to requiring "custom" data in the hooks.
```ts
export default RStoreSchema.withItemType().defineCollection({
name: 'User',
hooks: {
delete: ({ key }) =>
$fetch(`/api/app/users/me/delete`, {
method: 'POST',
body: {
// Can't get currentSessionPassword from parameters
currentSessionPassword: currentSessionPassword,
},
}),
},
});
```
### Suggested solution
A parameter that can be defined for each hook, so that custom data can be included.
### Alternative
I considered moving the logic of opening a modal and requesting the password into the hook, but that also seems a little cursed...
### Additional context
_No response_
### Validations
- [x] Follow our [Code of Conduct](https://github.com/Akryum/rstore/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [Contributing Guidelines](https://github.com/Akryum/rstore/blob/main/CONTRIBUTING.md).
- [x] Read the [docs](https://rstore.starpad.dev/guide/).
- [x] Check that there isn't [already an issue](https://github.com/Akryum/rstore/issues) that requests the same feature to avoid creating a duplicate.
Contributor guide
Assessment
This issue has not been assessed yet.