'use strict';

var localsHelper = require('../../../../utils/localsHelper.js');

class SelectedProductCollectionController {
    layoutPath;
    productCollectionStoreService;
    constructor(layoutPath, services) {
        this.layoutPath = layoutPath;
        this.productCollectionStoreService = services.productCollectionStoreService;
    }
    POST = async (req, res, _next) => {
        const { productCollection, returnTo } = req.body;
        const { dprUser } = localsHelper.default.getValues(res);
        await this.productCollectionStoreService
            .setSelectedProductCollectionId(dprUser.id, productCollection === 'RESET' ? undefined : productCollection)
            .then(() => {
            res.redirect(303, returnTo);
        })
            .catch(() => {
            res.redirect(303, returnTo);
        });
    };
}

exports.SelectedProductCollectionController = SelectedProductCollectionController;
//# sourceMappingURL=controller.js.map
