Skip to content

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 usingbeforeOpenandcheckOpened

Example:

ts
import{ currentUser }from"@/entities/user"constroute=newRoute('/foo/bar', {checkOpened: ()=>{returncurrentUser.isAuthorized;},beforeOpen: ()=>{returncurrentUser.isAuthorized;}})

Released under the MIT License.