Add Logout button to map page
Add logout functionality to map page header: - Import signOut from next-auth/react - Add Logout button next to Admin button - Use same red gradient styling as admin layout - Redirect to /login after logout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import Link from "next/link";
|
||||
import { signOut } from "next-auth/react";
|
||||
|
||||
const MapView = dynamic(() => import("@/components/map/MapView"), {
|
||||
ssr: false,
|
||||
@@ -127,7 +128,7 @@ export default function MapPage() {
|
||||
{/* Spacer to push buttons to the right */}
|
||||
<div className="hidden lg:block lg:flex-1"></div>
|
||||
|
||||
{/* Export and Admin Buttons */}
|
||||
{/* Export, Admin and Logout Buttons */}
|
||||
<div className="flex items-center gap-2">
|
||||
<a
|
||||
href="/export"
|
||||
@@ -142,6 +143,15 @@ export default function MapPage() {
|
||||
>
|
||||
Admin
|
||||
</a>
|
||||
<button
|
||||
onClick={async () => {
|
||||
await signOut({ redirect: false });
|
||||
window.location.href = '/login';
|
||||
}}
|
||||
className="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-gradient-to-r from-red-600 to-red-700 border border-red-600 rounded-lg hover:from-red-700 hover:to-red-800 transition-all duration-200 shadow-md hover:shadow-lg"
|
||||
>
|
||||
Logout
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user