import localsHelper from '../../../../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.getValues(res);
        await this.productCollectionStoreService
            .setSelectedProductCollectionId(dprUser.id, productCollection === 'RESET' ? undefined : productCollection)
            .then(() => {
            res.redirect(303, returnTo);
        })
            .catch(() => {
            res.redirect(303, returnTo);
        });
    };
}

export { SelectedProductCollectionController };
//# sourceMappingURL=controller.js.map
