Intercept a $patch #2632
Intercept a $patch
#2632
-
Hello, In my store, I would like to intercept $patch(..) calls and do some validation first before the store is actually updated. Is this possible? |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Apr 2, 2024
Replies: 1 comment 1 reply
-
You cannot intercept, only react to patches with |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ghost23
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You cannot intercept, only react to patches with
store.$subscribe()
(can be within a pinia plugin too). But it's not possible to do any validation. It sounds that what you want to do is an action that handles the validation of the input. It would help to add private state to that