Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // src/configs/routes.ts
- import {IPageRoute} from "../interfaces";
- export const publicRoutes: Array<IPageRoute> = [
- {
- path: '/forgot-password'
- },
- {
- path: '/register'
- }
- ]
- // AuthContext.tsx
- if(publicRoutes.some(route => route.path.includes(router.asPath)))
- router.push('/login')
- // interfaces
- export interface IPageRoute {
- path: string
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement