Middleware protected routes

This commit is contained in:
Brad Traversy
2024-07-10 10:45:02 -04:00
parent 74ea4baed8
commit 5417ba807d
2 changed files with 25 additions and 16 deletions
+20 -16
View File
@@ -93,14 +93,16 @@ const Navbar = () => {
> >
Properties Properties
</Link> </Link>
<Link {session && (
href='/properties/add' <Link
className={`${ href='/properties/add'
pathname === '/properties/add' ? 'bg-black' : '' className={`${
} text-white hover:bg-gray-900 hover:text-white rounded-md px-3 py-2`} pathname === '/properties/add' ? 'bg-black' : ''
> } text-white hover:bg-gray-900 hover:text-white rounded-md px-3 py-2`}
Add Property >
</Link> Add Property
</Link>
)}
</div> </div>
</div> </div>
</div> </div>
@@ -250,14 +252,16 @@ const Navbar = () => {
> >
Properties Properties
</Link> </Link>
<Link {session && (
href='/properties/add' <Link
className={`${ href='/properties/add'
pathname === '/properties/add' ? 'bg-black' : '' className={`${
} text-white block rounded-md px-3 py-2 text-base font-medium`} pathname === '/properties/add' ? 'bg-black' : ''
> } text-white block rounded-md px-3 py-2 text-base font-medium`}
Add Property >
</Link> Add Property
</Link>
)}
{!session && ( {!session && (
<div className='block md:ml-6'> <div className='block md:ml-6'>
<div className='flex items-center'> <div className='flex items-center'>
+5
View File
@@ -0,0 +1,5 @@
export { default } from 'next-auth/middleware';
export const config = {
matcher: ['/properties/add', '/profile', '/properties/saved', '/messages'],
};