init
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\AiMascotCampaign\Controller\Register;
|
||||
|
||||
use Esun\AiMascotCampaign\Model\CampaignContext;
|
||||
use Magento\Customer\Model\Session as CustomerSession;
|
||||
use Magento\Framework\App\Action\HttpGetActionInterface;
|
||||
use Magento\Framework\Controller\Result\Redirect;
|
||||
use Magento\Framework\Controller\Result\RedirectFactory;
|
||||
|
||||
class Start implements HttpGetActionInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CampaignContext $campaignContext,
|
||||
private readonly CustomerSession $customerSession,
|
||||
private readonly RedirectFactory $redirectFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function execute(): Redirect
|
||||
{
|
||||
if ($this->customerSession->isLoggedIn()) {
|
||||
return $this->redirectFactory->create()->setPath(
|
||||
'customer/account',
|
||||
['_secure' => true]
|
||||
);
|
||||
}
|
||||
|
||||
$this->campaignContext->start();
|
||||
|
||||
return $this->redirectFactory->create()->setPath(
|
||||
'customer/account/create',
|
||||
['_secure' => true]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user