@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
33 lines (29 loc) • 1.12 kB
JavaScript
;
var reportStoreService = require('../reportStoreService.js');
class ProductCollectionStoreService extends reportStoreService.ReportStoreService {
enabled;
constructor(reportDataStore, serviceFeatureConfig) {
super(reportDataStore);
this.enabled = Boolean(serviceFeatureConfig.collections);
}
async getSelectedProductCollectionId(userId) {
if (!this.enabled)
return undefined;
const userConfig = await this.getState(userId);
return userConfig.productCollectionInfo?.selectedProductCollection;
}
async setSelectedProductCollectionId(userId, id) {
if (!this.enabled)
return undefined;
const userConfig = await this.getState(userId);
return this.saveState(userId, {
...userConfig,
productCollectionInfo: {
...userConfig.productCollectionInfo,
selectedProductCollection: id,
},
});
}
}
exports.ProductCollectionStoreService = ProductCollectionStoreService;
//# sourceMappingURL=productCollectionStoreService.js.map