How to avoid using exit when redirecting from Observer
-
12-05-2021 - |
Frage
I have an observer that is triggered when a user creates an account. In the execute
method I have the following code:
public function execute(\Magento\Framework\Event\Observer $observer)
{
$redirectionUrl = $this->url->getUrl('subscribe');
$this->responseFactory->create()->setRedirect($redirectionUrl)->sendResponse();
exit;
}
It does infact redirect as expected, but the user is not logged in after registration.
How can I redirect without having to use exit
? If I remove exit
the redirect doesn't happen.
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange