UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

31 lines (28 loc) 1.06 kB
import { ReportStoreService } from '../reportStoreService.js'; class ProductCollectionStoreService extends 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, }, }); } } export { ProductCollectionStoreService }; //# sourceMappingURL=productCollectionStoreService.js.map