Protected routes
Protected routes are a very specific thing, dependent on technical project requirements, usually used for implementing routes closed to unauthorized users.
Implementation of such routes can be achieved in different ways
Configure protection usingbeforeOpen
andcheckOpened
Example:
ts
import{ currentUser }from"@/entities/user"constroute=newRoute('/foo/bar', {checkOpened: ()=>{returncurrentUser.isAuthorized;},beforeOpen: ()=>{returncurrentUser.isAuthorized;}})