From aece4bba6a0dbe7aafdf22c3c6b194ed6b0f954a Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 29 Jun 2021 22:10:43 +0200 Subject: [PATCH] add isCoach getter --- src/store/modules/coaches/getters.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/store/modules/coaches/getters.js b/src/store/modules/coaches/getters.js index d2a75ec..f1738d7 100644 --- a/src/store/modules/coaches/getters.js +++ b/src/store/modules/coaches/getters.js @@ -4,5 +4,10 @@ export default { }, 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); } };