From fefe208260b10eda6074de440679f7862fadbf2c Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 31 Jan 2022 13:32:34 +0100 Subject: [PATCH] accompanying course: fetch users and suggested referrers only for app, not for banner --- .../Resources/public/vuejs/AccompanyingCourse/index.js | 4 ++-- .../public/vuejs/AccompanyingCourse/store/index.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js index 2af2d2d21..8440e50d5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js @@ -13,7 +13,7 @@ const root = window.vueRootComponent; * Load all App component, for AccompanyingCourse edition page */ if (root === 'app') { - initPromise.then(store => { + initPromise(root).then(store => { const i18n = _createI18n(appMessages); @@ -37,7 +37,7 @@ if (root === 'app') { * Load only Banner sub-component, for all others AccompanyingCourse page */ if (root === 'banner') { - initPromise.then(store => { + initPromise(root).then(store => { const i18n = _createI18n(appMessages); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index f621838d2..2ce564b7a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -16,7 +16,7 @@ const id = window.accompanyingCourseId; let scopesPromise = fetchScopes(); let accompanyingCoursePromise = getAccompanyingCourse(id); -let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) +let initPromise = (root) => Promise.all([scopesPromise, accompanyingCoursePromise]) .then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => { const store = createStore({ @@ -796,8 +796,11 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) } }); - store.dispatch('fetchReferrersSuggested'); - store.dispatch('fetchUsers'); + if (root === 'app') { + store.dispatch('fetchReferrersSuggested'); + store.dispatch('fetchUsers'); + } + resolve(store); }));