Pinia-orm: How to add custom actions to the model or the store #1515
Unanswered
garma83
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hi,
I'm trying to add custom actions to the model, besides save, new, etc. I was hoping something like this would work:
static piniaOptions = {
actions: {
...useStoreActions(),
fetch() {
// do axios calls etc
},
}
and then either:
useRepo(Employee).piniaStore().fetch()
useRepo(Employee).fetch()
but this doesnt work. Is there a way that I can attach actions to either the pinia orm model, or the store?
I could make 'normal' static functions of course and then call
Employee.fetch()
but I would rather keep the structure similar to other store operations
Beta Was this translation helpful? Give feedback.
All reactions