This repository has been archived on 2021-07-29. You can view files and clone it, but cannot push or open issues or pull requests.
find_coach/src/store/modules/coaches/getters.js

14 lines
327 B
JavaScript

export default {
coaches(state) {
return state.coaches;
},
hasCoaches(state) {
return state.coaches && state.coaches.length > 0;
},
isCoach(_, getters, _2, rootGetters) {
const coaches = getters.coaches;
const userId = rootGetters.userId;
return coaches.some(coach => coach.id === userId);
}
};