@sunbird-cb/consumption 0.0.100 → 0.0.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1810,6 +1810,7 @@
1810
1810
  var WidgetUserServiceLib = /** @class */ (function () {
1811
1811
  function WidgetUserServiceLib(environment, http) {
1812
1812
  this.http = http;
1813
+ this.enrollmentDataIds = [];
1813
1814
  this.environment = environment;
1814
1815
  }
1815
1816
  /**
@@ -1889,6 +1890,7 @@
1889
1890
  if (content.contentStatus) {
1890
1891
  delete content.contentStatus;
1891
1892
  }
1893
+ _this.enrollmentDataIds.push(content.contentId);
1892
1894
  coursesData.push(content);
1893
1895
  }));
1894
1896
  _this.storeUserEnrollmentInfo(data.result.userCourseEnrolmentInfo, data.result.courses.length);
@@ -2135,7 +2137,7 @@
2135
2137
  function (userId, contentdata) {
2136
2138
  /** @type {?} */
2137
2139
  var path = API_END_POINTS.FETCH_USER_ENROLLMENT_LIST(userId);
2138
- path = path + "&courseIds=" + contentdata + "&cache=false'";
2140
+ path = path + "&courseIds=" + contentdata + "&cache=true'";
2139
2141
  /** @type {?} */
2140
2142
  var headers = new http.HttpHeaders({
2141
2143
  'Cache-Control': 'no-cache, no-store, must-revalidate, post-check=0, pre-check=0',
@@ -2342,6 +2344,8 @@
2342
2344
  if (false) {
2343
2345
  /** @type {?} */
2344
2346
  WidgetUserServiceLib.prototype.environment;
2347
+ /** @type {?} */
2348
+ WidgetUserServiceLib.prototype.enrollmentDataIds;
2345
2349
  /**
2346
2350
  * @type {?}
2347
2351
  * @private
@@ -3208,12 +3212,14 @@
3208
3212
  */
3209
3213
  function (doId) {
3210
3214
  return __awaiter(this, void 0, void 0, function () {
3211
- var userId, responseData;
3215
+ var enrolledDoId, userId, responseData;
3212
3216
  var _this = this;
3213
3217
  return __generator(this, function (_a) {
3214
3218
  switch (_a.label) {
3215
3219
  case 0:
3220
+ enrolledDoId = this.userSvc.enrollmentDataIds.includes(doId);
3216
3221
  userId = this.configSvc.userProfile.userId;
3222
+ if (!enrolledDoId) return [3 /*break*/, 2];
3217
3223
  return [4 /*yield*/, this.userSvc.fetchEnrollmentDataByContentId(userId, doId).toPromise().then((/**
3218
3224
  * @param {?} res
3219
3225
  * @return {?}
@@ -3238,6 +3244,7 @@
3238
3244
  case 1:
3239
3245
  responseData = _a.sent();
3240
3246
  return [2 /*return*/, responseData || []];
3247
+ case 2: return [2 /*return*/, []];
3241
3248
  }
3242
3249
  });
3243
3250
  });