diff --git a/src/Validator/Wishlist.php b/src/Validator/Wishlist.php index bd52565..f6ef00e 100644 --- a/src/Validator/Wishlist.php +++ b/src/Validator/Wishlist.php @@ -21,6 +21,7 @@ class Wishlist implements ValidatorInterface use PathTrait; const SHARED_URL_KEY = 'shared'; + const WISLIST_URL_KEY = 'wishlist'; /** * @var WishlistResourceModel @@ -42,8 +43,16 @@ public function __construct(WishlistResourceModel $wishlistResource, WishlistFac $this->wishlistFactory = $wishlistFactory; } + /** + * @param RequestInterface $request + * @return bool + */ public function validateRequest(RequestInterface $request): bool { + if ($this->checkIfAccountWishlistTab($request)) { + return true; + } + $urlKey = $this->getPathFrontName($request); if ($urlKey !== self::SHARED_URL_KEY) { @@ -55,6 +64,10 @@ public function validateRequest(RequestInterface $request): bool return $this->checkIsShared($sharingKey); } + /** + * @param string $sharingKey + * @return bool + */ protected function checkIsShared(string $sharingKey): bool { /** @var WishlistModel $wishlist */ @@ -68,6 +81,10 @@ protected function checkIsShared(string $sharingKey): bool return true; } + /** + * @param RequestInterface $request + * @return string + */ protected function getSharingKey(RequestInterface $request): string { $path = trim($request->getPathInfo(), '/'); @@ -75,4 +92,20 @@ protected function getSharingKey(RequestInterface $request): string return end($params); } + + /** + * @param RequestInterface $request + * @return bool + */ + public function checkIfAccountWishlistTab(RequestInterface $request): bool + { + $path = trim($request->getPathInfo(), '/'); + $params = explode('/', $path); + + if (count($params) === 1 && $params[0] === self::WISLIST_URL_KEY) { + return true; + } + + return false; + } } diff --git a/src/etc/di.xml b/src/etc/di.xml index 84d87ca..a63aff5 100644 --- a/src/etc/di.xml +++ b/src/etc/di.xml @@ -26,6 +26,10 @@ ScandiPWA\Router\Validator\Wishlist ScandiPWA\Router\Validator\AlwaysPass ScandiPWA\Router\Validator\AlwaysPass + ScandiPWA\Router\Validator\AlwaysPass + ScandiPWA\Router\Validator\AlwaysPass + ScandiPWA\Router\Validator\AlwaysPass + ScandiPWA\Router\Validator\AlwaysPass