accompanying course: fetch scopes only for app (not for banner)

This commit is contained in:
nobohan 2022-01-31 13:46:43 +01:00
parent fefe208260
commit 2eb5c45a4d

View File

@ -13,10 +13,14 @@ import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
const debug = process.env.NODE_ENV !== 'production'; const debug = process.env.NODE_ENV !== 'production';
const id = window.accompanyingCourseId; const id = window.accompanyingCourseId;
let scopesPromise = fetchScopes(); let getScopesPromise = (root) => {
if (root === 'app') {
return fetchScopes();
}
}
let accompanyingCoursePromise = getAccompanyingCourse(id); let accompanyingCoursePromise = getAccompanyingCourse(id);
let initPromise = (root) => Promise.all([scopesPromise, accompanyingCoursePromise]) let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCoursePromise])
.then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => { .then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => {
const store = createStore({ const store = createStore({