I want to build a custom controller, which works as follows:
- if user already have admin session, redirect user to admin page A
- if user does not have admin session, redirect user to storefront page B
Is there a way to achieve this?
First I tried building custom logic in adminhtml/controller
but it didn't work because for case (2), magento shows admin login UI even before any of my controller logic runs.
Then I tried building custom logic in frontend controller but that won't work for case (1) because it's not possible from frontend to tell admin session ( How to get admin session(user) details on front side in Magento 2? )
Any advise would be appreciated.