diff --git a/.replit b/.replit index 2c6be92..b0526f5 100644 --- a/.replit +++ b/.replit @@ -22,10 +22,6 @@ externalPort = 3002 localPort = 37531 externalPort = 3001 -[[ports]] -localPort = 40799 -externalPort = 3003 - [[ports]] localPort = 43349 externalPort = 3000 diff --git a/attached_assets/스크린샷 2025-09-30 오전 5.49.02_1759178956266.png b/attached_assets/스크린샷 2025-09-30 오전 5.49.02_1759178956266.png new file mode 100644 index 0000000..eeb0083 Binary files /dev/null and b/attached_assets/스크린샷 2025-09-30 오전 5.49.02_1759178956266.png differ diff --git a/client/src/pages/AdminDashboard.tsx b/client/src/pages/AdminDashboard.tsx index 2f3dbfe..db9b39e 100644 --- a/client/src/pages/AdminDashboard.tsx +++ b/client/src/pages/AdminDashboard.tsx @@ -11,10 +11,13 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@ import type { MediaOutlet } from "@shared/schema"; import MediaOutletManagement from "@/components/MediaOutletManagement"; import Footer from "@/components/Footer"; +import { useLocation } from "wouter"; +import { queryClient } from "@/lib/queryClient"; export default function AdminDashboard() { const { user, isLoading } = useAuth(); const { toast } = useToast(); + const [, setLocation] = useLocation(); const [searchTerm, setSearchTerm] = useState(""); const [selectedOutlet, setSelectedOutlet] = useState(null); const [managingOutlet, setManagingOutlet] = useState(null); @@ -29,7 +32,7 @@ export default function AdminDashboard() { variant: "destructive", }); setTimeout(() => { - window.location.href = "/"; + setLocation("/"); }, 500); } }, [isLoading, user, toast]); @@ -78,8 +81,29 @@ export default function AdminDashboard() { }); }; - const handleLogout = () => { - window.location.href = "/api/logout"; + const handleLogout = async () => { + try { + const response = await fetch("/api/logout", { + method: "POST", + credentials: "include", + }); + + if (response.ok) { + toast({ + title: "Logged Out", + description: "You have been successfully logged out.", + }); + + queryClient.invalidateQueries({ queryKey: ["/api/auth/user"] }); + setLocation("/"); + } + } catch (error) { + toast({ + title: "Logout Error", + description: "An error occurred while logging out.", + variant: "destructive", + }); + } }; if (isLoading || !user || (user.role !== 'admin' && user.role !== 'superadmin')) { @@ -107,14 +131,13 @@ export default function AdminDashboard() {
- - SAPIENS - + SAPIENS setLocation("/")} + />

Admin Dashboard

@@ -135,6 +158,15 @@ export default function AdminDashboard() { />
+ + + + <> + + + )} ) : ( - + <> + + + )} +
); @@ -212,7 +222,7 @@ export default function MediaOutlet() { alt="SAPIENS" className="h-6 w-auto cursor-pointer" data-testid="logo-sapiens" - onClick={() => window.location.href = "/"} + onClick={() => setLocation("/")} />
@@ -235,6 +245,15 @@ export default function MediaOutlet() { {isAuthenticated && user ? ( <> + +