Middleware protected routes
This commit is contained in:
+20
-16
@@ -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'>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export { default } from 'next-auth/middleware';
|
||||||
|
|
||||||
|
export const config = {
|
||||||
|
matcher: ['/properties/add', '/profile', '/properties/saved', '/messages'],
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user