Access Sparks currentTeam.users in combination with vuex
Hey everyone, this question is kind of a mix between vue/vuex and Spark but maybe someone can help me anyway:
Hey. How would you access data of the current team in combination with vuex and a computed property in the frontend?
I have a table with tasks which contains a column task_owner_id
my vuex tasks object contains all tasks, so the task_owner_id is available in the frontend
Now I want to display the users name via a computed property.
I know I can get the data of the currentTeam with
Spark.state.currentTeam.users
But if I re-assign the task to someone elses id (-> task_owner_id) it works if I just let the computed property do the action of the vuex store but not if I try to match it in combination with the users object of Spark either in the component or in the store. It always show the same name (probably the first one it can find in the array).
I try to do something like this (not refactored yet):
var taskOwnerId = user.task_owner_ids;
var teamMembers = Spark.state.currentTeam.users;
var singleTeammember = teamMembers.find(member => taskOwnerId => member.id === taskOwnerId);
This is where always the same name gets returned but doesn't change if I reassign a user but where I want to use the power of computed properties.
Think of the feature like assigning someone in Trello where the changes should be visible immediately after doing so.
Hope you can understand what I try to achieve here.
Thanks in advance. ☺️
Please or to participate in this conversation.