fix: replace Firebase signOut with NextAuth signOut in left rail
Firebase is not configured - auth was undefined causing the error 'Cannot read properties of undefined (reading signOut)'. Use next-auth/react signOut with callbackUrl to redirect to /auth. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
LayoutGrid,
|
||||
@@ -13,9 +13,7 @@ import {
|
||||
LogOut,
|
||||
} from "lucide-react";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { signOut } from "@/lib/firebase/auth";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { signOut } from "next-auth/react";
|
||||
interface WorkspaceLeftRailProps {
|
||||
activeSection?: string;
|
||||
onSectionChange: (section: string) => void;
|
||||
@@ -56,19 +54,12 @@ const navItems = [
|
||||
|
||||
export function WorkspaceLeftRail({ activeSection = 'projects', onSectionChange }: WorkspaceLeftRailProps) {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
// Extract workspace from pathname (e.g., /marks-account/projects -> marks-account)
|
||||
const workspace = pathname?.split('/')[1] || 'marks-account';
|
||||
|
||||
const handleSignOut = async () => {
|
||||
try {
|
||||
await signOut();
|
||||
toast.success("Signed out successfully");
|
||||
router.push("/auth");
|
||||
} catch (error: any) {
|
||||
toast.error(error.message);
|
||||
}
|
||||
await signOut({ callbackUrl: "/auth" });
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user