accompanying course: fetch users and suggested referrers only for app, not for banner

This commit is contained in:
nobohan 2022-01-31 13:32:34 +01:00
parent 1967fc4bed
commit fefe208260
2 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ const root = window.vueRootComponent;
* Load all App component, for AccompanyingCourse edition page * Load all App component, for AccompanyingCourse edition page
*/ */
if (root === 'app') { if (root === 'app') {
initPromise.then(store => { initPromise(root).then(store => {
const i18n = _createI18n(appMessages); const i18n = _createI18n(appMessages);
@ -37,7 +37,7 @@ if (root === 'app') {
* Load only Banner sub-component, for all others AccompanyingCourse page * Load only Banner sub-component, for all others AccompanyingCourse page
*/ */
if (root === 'banner') { if (root === 'banner') {
initPromise.then(store => { initPromise(root).then(store => {
const i18n = _createI18n(appMessages); const i18n = _createI18n(appMessages);

View File

@ -16,7 +16,7 @@ const id = window.accompanyingCourseId;
let scopesPromise = fetchScopes(); let scopesPromise = fetchScopes();
let accompanyingCoursePromise = getAccompanyingCourse(id); let accompanyingCoursePromise = getAccompanyingCourse(id);
let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) let initPromise = (root) => Promise.all([scopesPromise, accompanyingCoursePromise])
.then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => { .then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => {
const store = createStore({ const store = createStore({
@ -796,8 +796,11 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
} }
}); });
store.dispatch('fetchReferrersSuggested'); if (root === 'app') {
store.dispatch('fetchUsers'); store.dispatch('fetchReferrersSuggested');
store.dispatch('fetchUsers');
}
resolve(store); resolve(store);
})); }));