_customerSession = $customerSession; } /** * Check customer authentication for some actions * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->_customerSession->authenticate()) { $this->_actionFlag->set('', 'no-dispatch', true); } return parent::dispatch($request); } }