How to know which action triggered the state change? #1777
-
I have the following store configured import { defineStore } from "pinia";
export const useUserStore = defineStore({
id: "userStore",
state: () => ({
userInfo: "",
userFeatures: [],
}),
actions: {
setUserInfo(userInfo){
this.userInfo = userInfo;
},
setUserFeatures(userFeatures){
this.userFeatures = userFeatures;
}
}
}); I have also subscribed to userStore to listen to any state change. How can I differentiate between the setUserInfo and setUserFeatures action in the subscription callback? |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Nov 6, 2022
Replies: 1 comment
-
You can't. You can however subscribe to actions: https://pinia.vuejs.org/core-concepts/actions.html#with-setup |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't. You can however subscribe to actions: https://pinia.vuejs.org/core-concepts/actions.html#with-setup